Some static files are throwing 404 when deploying Django on vercel

198 Views Asked by At

I am deploying my Django project on vercel

This is my vercel.json file

{
"version": 2,
"builds": [
    {
        "src": "event_management/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": "event_management/wsgi.py"
    }
]

}

my settings.py

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

everything works fine but when I open the admin panel one CSS file static/admin/css/base.css is throwing 404 error all the other static files are loading fine

Here is the admin panel link.

the base.css is even listed in Vercel static Assets enter image description here

You can also check the file is present on the directory listing here

here is my github repo link the code is in main branch

1

There are 1 best solutions below

0
Steve Yonkeu On

After inspecting the logs and the files present, I can see all works fine, the css file for the base.css for the admin panel returned a response 300. enter image description here

So, the solution is all good.

just incase you left it out, it will good to install and configure white noise.