【发布时间】:2017-07-15 02:13:49
【问题描述】:
我是 django 的新手!当我使用逗号时,git push heroku master 出现此错误。
remote: django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
我的静态文件声明是:
STATIC_URL = '/static/'
# set for the Heroku deployment.
import dj_database_url
DATABASES = {
'default': dj_database_url.config(default='postgres://localhost')
}
#make reuqest.is_secure admit X-Forwarded-Proto
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# support all the host header
ALLOWED_HOSTS = ['*']
#static configuration
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
我的 requirements.txt/runtime.txt/Procfile 都很好,我google了很多,即使尝试了白噪声,我仍然无法修复它,所以有人可以帮助我吗?非常感谢!
我的 requirements.txt 如下: dj-database-url==0.4.2
dj-static==0.0.6
Django==1.11.1
django-bootstrap3==8.2.3
gunicorn==19.7.1
pytz==2017.2
static3==0.7.0
如果我这样做了heroku config:set DISABLE_COLLECTSTATIC=1
可以推送成功,但是因为一些错误,博客页面没有显示出来。
【问题讨论】: