简体   繁体   English

配置不当:您使用的是staticfiles应用,而未将STATIC_ROOT设置设置为文件系统路径

[英]ImproperlyConfigured:You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path

I am new to django ! 我是django的新手! When I use the commad, git push heroku master I get this error. 当我使用commad, 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

My static files declarations are : 我的静态文件声明为:

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'),
)

My requirements.txt/runtime.txt/Procfile are all good, I googled a lot, Even tried the whitenoise, still I cannot fix it, so can someone help me? 我的requirements.txt / runtime.txt / Procfile都很好,我在Google上搜索了很多,即使尝试了白噪声,还是无法解决,所以有人可以帮助我吗? Thanks a lot! 非常感谢!

My requirements.txt are like below: dj-database-url==0.4.2 我的requirements.txt如下所示:dj-database-url == 0.4.2

dj-static==0.0.6 dj-static == 0.0.6

Django==1.11.1 的Django = = 1.11.1

django-bootstrap3==8.2.3 django-bootstrap3 == 8.2.3

gunicorn==19.7.1 gunicorn == 19.7.1

pytz==2017.2 pytz == 2017.2

static3==0.7.0 静态3 == 0.7.0

IF I do heroku config:set DISABLE_COLLECTSTATIC=1 I can push successfully, but the blog page does not show out because of some error. 如果我执行heroku config:set DISABLE_COLLECTSTATIC=1我可以成功推送,但是由于某些错误,博客页面不会显示出来。

You have to put in settings File STATIC_ROOT conf. 您必须输入设置文件STATIC_ROOT conf。 The best you can do in production is serve static files through amazon s3 or another cdn so you don't overload your server. 生产中最好的方法是通过Amazon s3或其他CDN提供静态文件,以免服务器超载。

See the Django static files docs for more information. 有关更多信息,请参见Django静态文件文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 django.core.exceptions.ImproperlyConfigured:您使用的是静态文件应用程序,而没有将 STATIC_ROOT 设置设置为文件系统路径 - django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path 您正在使用 staticfiles 应用程序,而没有将 STATIC_ROOT 设置设置为文件系统路径 - You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path Python Django:您使用的是静态文件应用程序,而没有将 STATIC_ROOT 设置设置为文件系统路径 - Python Django: You're using the staticfiles app without having set the STATIC_ROOT setting setting to a filesystem path Python Django:您正在使用 staticfiles 应用程序,而没有设置 STATIC_ROOT 设置 - Python Django: You're using the staticfiles app without having set the STATIC_ROOT setting 您正在使用 staticfiles 应用程序,但没有设置所需的 STATIC_URL 设置 - Django - You're using the staticfiles app without having set the required STATIC_URL setting - Django Django 中的 STATIC_ROOT 设置 - STATIC_ROOT setting in Django 在 Django 中使用 heroku 时出现 STATIC_ROOT 错误 - Having an Error with STATIC_ROOT when using heroku in Django 使用静态根路径django的heroku deploy错误。 static_root未设置为文件系统路径 - heroku deploy error with static root path django. static_root not set to file system path STATICFILES_DIR、STATIC_ROOT 和 MEDIA_ROOT 的区别 - Differences between STATICFILES_DIR, STATIC_ROOT and MEDIA_ROOT 在Django中更改STATIC_ROOT和STATICFILES_DIRS后不会加载静态文件 - Static files aren't loading after changing STATIC_ROOT and STATICFILES_DIRS in django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM