Forums

django media files uploads into media directory but doesn't appear on webpage

Hello.. I just deployed a django project here on pythonanywhere, I'm having a difficulty, my site is working fine with all my static files but my user uploaded files (media files) uploads into the media directory but doesn't show up on my webpage. I'm new to pythonanywhere, really need help. Thanks

It looks like you need to set up a mapping in the "Static files" table on the "Web" tab for your media upload directory. For Django, it would normally be from the URL /media to a directory similar to the one you've specified for /static but with media replacing static -- so, for example, if your existing mapping for static goes to the directory

/home/wofstech/mysite/static

...then the one for /media would go to

/home/wofstech/mysite/media

I had the same problem, but now it's gone because of you. Thanks a lot.