Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
473 views
in Technique[技术] by (71.8m points)

django - Collecting staticfiles throws ImproperlyConfigured

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'),
)
question from:https://stackoverflow.com/questions/27213752/collecting-staticfiles-throws-improperlyconfigured

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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/'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...