Django Static files 404

djangohttp-status-code-404static

I can't get my static files to come up. I've tried various settings and directory configurations and so on, but they just turn up as 404s. I have debug_toolbar installed so know that STATIC_URL is reaching my request context.

Directory structure showing /static (I have also placed the directory inside of the meals app folder, and users, just to try it out.

/mealmate
    /mealmate
    /meals
    /static
        /css
             /bootstrap.min.css
    /templates
    /users

Settings.py (a few important settings though I've experimented with a variety of other ones):

MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media/')

STATIC_URL = '/static/'

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

WSGI_APPLICATION = 'mealmate.wsgi.application'

In base.html rendered

    <link rel="stylesheet" href="/static/css/bootstrap.min.css">

Any ideas?
Thanks

Best Answer

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'), )
Related Topic