Solution 1:

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

settings.py

import os.path

STATIC_ROOT = ''

STATIC_URL = '/static/'

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

Solution 2:

For me this turned out to be caused by setting debug to false in settings.py. A workaround is to pass the --insecure switch to runserver, but the real solution is to use a proper web server to serve the static files. See the answers to this question for more details.

Solution 3:

If you are running this on a web server are you copying the static files to a public accessible folder? For example:

# web accessible folder
STATIC_ROOT = '/home/your_name/www/mealmate/static/'

# URL prefix for static files.
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # location of your application, should not be public web accessible 
    '/home/your_name/website/mealmate/static',
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

Then you can use this post Django static Files and copy the static files to the public accessible folder using manage.py

# --link    Create a symbolic link to each file instead of copying.
# --noinput Do NOT prompt the user for input of any kind.
#
python manage.py collectstatic -link --noinput

Hope that helps!

Solution 4:

from comments above - run this

python manage.py findstatic --verbosity 2 css/styles.css

No matching file found for 'css/styles.css'.

Looking in the following locations:
/Users/yourname/Documents/Workspace/test/staticfiles

I simply renamed my static folder to staticfiles and all was well. (I'm on osx + django 1.x)

use insecure mode may not hurt if you're on local dev box - otherwise you may still get 404 errors.

python manage.py runserver --insecure

UPDATE

actually digging into settings.py found the infringing line.

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

Solution 5:

If you recently changed the debug to false in settings file. Follow this procedure.

Most of the time it is caused by debug setting to be false in settings.py. If you pass the --insecure switch to runserver it should work. So if you do python manage.py runserver 0.0.0.0:8000 change it to python manage.py runserver 0.0.0.0:8000 --insecure instead.

It should work.