#After deploying django onto Vercel, all the staticfiles can't find.

2 messages · Page 1 of 1 (latest)

silent lagoon
#

I am not very professional at Python. But I have great interest.

It is my first time to deploy a project. And it worked perfectly locally.

But after I deployed my projects, all staticfiles couldn't be found even though they were there. I have no idea why.

In my setting.py, I used these codes.

STATIC_URL = '/staticfiles/'
MEDIA_URL = '/images/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'staticfiles'),
]

and in home.html, I used this.

{% load static %}

I have no idea why ... I have spent day and night for this mistake...
https://tenor.com/view/sad-gif-13261737358986789359

pearl vigil
#

don't know how it works for vercel but you need STATIC_ROOT, then you run python manage.py collecstatic which will copy your static files to STATIC_ROOT directory, then you serve these files with web server (nginx/apache etc)