[Django]-Django 1.8 Why local static requests raise 404?

2👍

Perhaps you’re missing the STATICFILES_DIRS setting.

When in production, python manage.py collectstatic moves all static files inside STATIC_ROOT directory so nginx can look up here for them, however in dev mode, django needs to know where the static files are, and use STATICFILES_DIRS tuple for that.

If you have these files inside exam/static, your STATICFILES_DIRS should looks like:

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)

1👍

If you are using ./manage runserver then you’re missing STATICFILES_DIRS.

For nginx/gunicorn http://nginx.com/resources/admin-guide/serving-static-content/. Also Django White Noise

Leave a comment