Django: Unable to serve static media

April 26, 2015 6.9k views
Python Django

Hello all, very new to Django and am trying out the tutorial here and I can’t seem to get it to serve static content. I’ve performed the following configurations in my

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATIC_PATH = os.path.join(BASE_DIR,'static/')

STATIC_URL = '/static/'


my file is located at:


when I use the full URL:

I end up with the 404 Not Found nginx/1.4.6 (Ubuntu) error. Did I missed out on anything?

1 Answer

turns out there’s one more step I missed. I had to go to nginx’s configuration file at


to change the line from the previous one to reflect my folder arrangement.

 location /static {
       # alias /home/django/django_project/django_project/static;
        alias /home/django/django_project/static;

restarted nginx and all is well!

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!