gpt4 book ai didi

python - Django WhiteNoise配置与WhiteNoise v4.0不兼容

转载 作者:行者123 更新时间:2023-12-04 18:18:48 25 4
gpt4 key购买 nike

我正在尝试在Heroku上部署Django Webapp。每次尝试部署时,我都面临着同样的错误。

ImportError: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0 This can be fixed by following the upgrade instructions at: http://whitenoise.evans.io/en/stable/changelog.html#v4-0 ! Error while running '$ python manage.py collectstatic --noinput'. See traceback above for details. You may need to update application code to resolve this error. Or, you can disable collectstatic for this application: $ heroku config:set DISABLE_COLLECTSTATIC=1 https://devcenter.heroku.com/articles/django-assets ! Push rejected, failed to compile Python app. ! Push failed



我访问了该链接以按照文档的建议进行更改。它要求我从wsgi.py文件中删除所有提及,并且必须将其添加到settings.py中的中间件并更改静态存储。
#settings.py
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
.
.
.
.
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

我正在关注本教程( https://simpleisbetterthancomplex.com/tutorial/2016/08/09/how-to-deploy-django-applications-on-heroku.html)

我不确定是什么导致此错误。将应用Whitenoise更新,并且静态文件也就位。

该项目在本地服务器上的工作方式很吸引人,但是我无法将其部署。
提前致谢!

最佳答案

whitenoise.django.GzipManifestStaticFilesStorage

别名现已删除。相反,您应该使用正确的导入路径:
whitenoise.storage.CompressedManifestStaticFilesStorage

来源 Link

关于python - Django WhiteNoise配置与WhiteNoise v4.0不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55813584/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com