Forums

Can you help me on my media files not loading on the site?

settings.py

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

MEDIA_ROOT = os.path.join(BASE_DIR, '/media/') MEDIA_URL = '/media/'

web tab -> static files:

URL - /media/ Directory - /home/chicodelacruz/startupPRJ/media/

what should be the workaround here? since those image files are came from upload on admin side

Hi, we have a help page on setting up static files for Django: https://help.pythonanywhere.com/pages/DjangoStaticFiles. Also -- did you check your error logs? I see that the view for the root url is missing and there are requests for static files in different locations.

Hi, Can you please help me with this one? I spent a day debugging this one. Am I missing something?

Here is the URL that I am solving first. https://chicodelacruz.pythonanywhere.com/users/

You look for a picture at https://chicodelacruz.pythonanywhere.com/users/media/profile_pic/image.jpg but it is served on https://chicodelacruz.pythonanywhere.com/media/profile_pic/image.jpg

Okay I finally saw my mistake. Thank you.

OK -- glad we could help!