So I've never deployed a Django app and I'm trying to get up to speed on the whole thing. I ran the collectstatic command and now non of my static files will render. When I run the findstatic command I receive an exception that says:
django.core.exceptions.ImproperlyConfigured: The storage backend of the staticfiles finder <class 'django.contrib.staticfiles.finders.DefaultStorageFinder'> doesn't have a valid location.
My template renders just find but I can't seem to figure out why the css file is not being found. Highlight from my settings module:
settings/
base.py
devel.py
prod.py
base.py
cwd = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT = cwd[:-9] # chop off "settings/"
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
]
TEMPLATE_LOADERS = [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
]
TEMPLATE_DIRS = [
os.path.join(PROJECT_ROOT, "templates"),
]
devl.py
STATIC_URL = "/site_media/static/"
STATICFILES_DIRS = [
os.path.join(PROJECT_ROOT, "site_media", "static"),
]
STATIC_ROOT = os.path.join(PROJECT_ROOT, "site_media", "static")
site_base.html
<link rel="stylesheet" href="{{ STATIC_URL }}css/site_base.css" />
Would appreciate your help because Im stumped.
Update:
It turned out to be a missing context processor. To get your STATIC_URL setting inside a template, you have to register the
staticfiles
context processor:First stab:
It looks like you'll need to add that dir to your list of static sources (re: a comment above):