[Django]-Django staticfiles error

3👍

You have misconfigured staticfiles in your settings maybe?

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

make sure you have the context processor:

TEMPLATE_CONTEXT_PROCESSORS = [
    ...
    'django.core.context_processors.static',
    ...
]

Also don’t use paths like that, used to provide absolute paths…

from os.path import join, dirname, normpath

LOCAL_PATH = normpath(join(dirname(__file__), '..'))

then you can do…

# Additional locations of static files
STATICFILES_DIRS = (
    LOCAL_PATH + '/public/common/',
)

=========

here is an example of how I set mine up

MEDIA_ROOT = ''
MEDIA_URL = ''

STATIC_ROOT = '/uploaded/'
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    LOCAL_PATH + '/public/common/',
)

    # 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',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

In my installed apps I make sure I have

'django.contrib.staticfiles',

Leave a comment