Django isn't serving static files, getting 404 errors Django isn't serving static files, getting 404 errors django django

Django isn't serving static files, getting 404 errors


Have you defined your static files directory in settings.py ?

I'm guessing you have 'django.contrib.staticfiles', in your installed apps.

If you haven't defined your static files dir, you could by doing something like this:

import os.pathPROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))STATICFILES_DIRS = (    os.path.join(PROJECT_ROOT, 'static'),)


This is the working solution for static/media/template access in django for windows,

settings.py

import os.pathSTATIC_ROOT = ''STATIC_URL = '/static/'STATICFILES_DIRS = (    os.path.join('static'),)


My problem was solved by adding "STATICFILES_DIRS" in settings.py file

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