I'm using Django 1.7. When deploying my site to a Production server and running collectstatic
, I get following error message: django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting
I use split settings; my production local.py
contains:
STATIC_ROOT = '/home/username/projects/site/static/'
and my base.py
contains:
STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), )
STATICFILES_DIRS is the list of folders where Django will search for additional static files aside from the static folder of each app installed.
collectstatic. django-admin collectstatic. Collects the static files into STATIC_ROOT . Duplicate file names are by default resolved in a similar way to how template resolution works: the file that is first found in one of the specified locations will be used.
Configuring static filesMake sure that django.contrib.staticfiles is included in your INSTALLED_APPS . In your templates, use the static template tag to build the URL for the given relative path using the configured STATICFILES_STORAGE . Store your static files in a folder called static in your app.
staticfiles app? Explanation : All of the above are variables are the settings for django.
According to the docs, collectstatic will copy the files from various folders into STATIC_ROOT.
Therefore, you cannot use the STATIC_ROOT
folder in STATICFILES_DIRS
.
Solution: change STATIC_ROOT
to e.g. STATIC_ROOT = '/home/username/projects/site/assets/'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With