# I'm failing my vercel deployment, please help

**URL:** <https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226>\
**Category:** Deployment\
**Created:** [August 27, 2024, 10:16am UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226 "2024-08-27T10:16:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![UzitheI](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/uzithei/32/23360_2.png) [@UzitheI](https://forum.djangoproject.com/u/UzitheI)\
**Post date:** [August 27, 2024, 10:16am UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226/1 "2024-08-27T10:16:14Z")

</div>

I wanted to deploy my django app through vercel and I think I’ve done everything correctly but the deployed site gives a **404** : NOT\_FOUNDCode: `NOT_FOUND` error. I didnt get any errors when building and my runtime logs are empty too. I’ve made sure my build\_files.sh and vercel.json files are in root directory. I’ve attached necessary files below:

```auto
#settings.py

STATIC_URL = "static/"
STATICFILES_DIRS = [
    BASE_DIR / "static",
]

STATIC_ROOT = os.path.join(BASE_DIR /'staticfiles','staticfiles_build','static')

ALLOWED_HOSTS = ['127.0.0.1','localhost', ".vercel.app"]

```

Here is my build\_file

```auto
#build_files.sh

echo "BUILD START"

python3.9 -m pip install -r requirements.txt
python3.9 manage.py collectstatic --noinput --clear

echo "BUILD END"

```

and here is my vercel.json file

```auto
{
  "version": 2,
  "builds": [
    {
      "src": "mysite/wsgi.py",
      "use": "@vercel/python",
      "config": { "maxLambdaSize": "15mb", "runtime": "python3.9" }
    },
    {
      "src": "build_files.sh",
      "use": "@vercel/static-build",
      "config": {
        "distDir": "staticfiles_build"
      }
    }
  ],
  "routes": [
    {
      "src": "/static/(.*)",
      "dest": "/static/$1"
    },
    {
      "src": "/(.*)",
      "dest": "mysite/wsgi.py"
    }
  ]
}

```

i’ve made sure i hit pip freeze for my requirements, i’ve also made sure my env variables are provided in the vercel settings. My database is postgresql and its currently hosted through aiven. i’ve also made sure that app = application is done in my wsgi.py inside my main app

---

<div class="post-metadata">

**Author:** ![comethrusws](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/comethrusws/32/23514_2.png) [@comethrusws](https://forum.djangoproject.com/u/comethrusws)\
**Post date:** [August 27, 2024, 11:24am UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226/2 "2024-08-27T11:24:18Z")

</div>

i’ve run into similar issues before, so let me share a few things that might help:

1. Double-check your wsgi.py file. Make sure it has both `application = get_wsgi_application()` and `app = application`. Sometimes Vercel can be picky about this.

2. Have you tried setting `DEBUG = True ` temporarily? It might give you more detailed error info to work with.

3. Your vercel.json looks good, but you could try adding “cleanUrls”: true to it. Sometimes that helps with routing issues.

4. Even though your runtime logs are empty, dig into the Vercel deployment logs if you haven’t yet.

5. This might sound silly, but double-check that your project structure matches what’s in your vercel.json. I’ve lost hours before realizing I had a typo in a stupid directory name

6. If none of that works, try a fresh deployment by running `vercel --prod` from your local machine. Sometimes clearing the Vercel cache can work at times yk.

If you’re still stuck after trying these, i suggest creating a bare-bones Django project and deploying that successfully, then gradually adding your components back in. It’s a pain, but it can help pinpoint the issue.

---

<div class="post-metadata">

**Author:** ![comethrusws](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/comethrusws/32/23514_2.png) [@comethrusws](https://forum.djangoproject.com/u/comethrusws)\
**Post date:** [August 27, 2024, 11:33am UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226/3 "2024-08-27T11:33:45Z")

</div>

alternatively? i noticed some issues:

1. Database configuration:  
Since you’re using PostgreSQL hosted on Aiven, double-check your database settings in `settings.py`. Make sure you’re using environment variables for sensitive information:

make sure these environment variables are correctly set in Vercel’s dashboard (ik you probably have. but its worth trying)

1. Static files configuration:  
Your `STATIC_ROOT` setting looks unusual. Try simplifying it:

2. `build_files.sh`:  
you sure this is executable? you might need to run `chmod +x build_files.sh` locally before deploying.

3. Python version:  
your `build_files.sh` specifies Python 3.9, but make sure this matches the version in your `vercel.json` and the version you’re using locally.

4. URL configuration:  
shpuld check your `urls.py` files (both in the project and app directories) to ensure all URLs are correctly defined.

5. Middleware:  
chevk your `MIDDLEWARE` setting in `settings.py`. Ensure there’s no custom middleware interfering with request handling.

6. Django version:  
make sure your Django version is compatible with Vercel. Try specifying the exact version in your `requirements.txt`:

7. `ALLOWED_HOSTS`:  
i mean, while it looks good enough, try adding your specific Vercel app URL:

8. Root URL configuration:  
Ensure your project’s `urls.py` includes a root URL pattern:

```python
from django.urls import path
from your_app import views

urlpatterns = [
    path('', views.home, name='home'),
    # other URL patterns...
]

```

1. Vercel CLI:  
If possible, try deploying using the Vercel CLI tool. It often provides more detailed error messages:

---

<div class="post-metadata">

**Author:** ![UzitheI](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/uzithei/32/23360_2.png) [@UzitheI](https://forum.djangoproject.com/u/UzitheI)\
**Post date:** [August 27, 2024, 3:37pm UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226/4 "2024-08-27T15:37:08Z")

</div>

Thank you sir. Still with the issue, but the cli suggestion has been really helpfull.

---

<div class="post-metadata">

**Author:** ![njeruthuo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/njeruthuo/32/28570_2.png) [@njeruthuo](https://forum.djangoproject.com/u/njeruthuo)\
**Post date:** [May 19, 2025, 6:14am UTC](https://forum.djangoproject.com/t/im-failing-my-vercel-deployment-please-help/34226/5 "2025-05-19T06:14:43Z")

</div>

Hello,

If everything else is perfect i.e vercel.json build\_files etc, the issue is mostly a typo. Just like I found out about 10 seconds ago after reading your reply.  
Thanks.
