简体   繁体   English

模块“whitenoise.django”错误中没有名称“DjangoWhiteNoise”

[英]No name 'DjangoWhiteNoise' in module 'whitenoise.django' Error

I'm currently in the process of deploying my django app to Heroku, and the walkthrough I'm following is having me add the following code to my wsgi file.我目前正在将我的 django 应用程序部署到 Heroku,我正在遵循的演练是让我将以下代码添加到我的 wsgi 文件中。 Only issue is that I'm getting an error that No name 'DjangoWhiteNoise' in module 'whitenoise.django'唯一的问题是我收到一个错误, No name 'DjangoWhiteNoise' in module 'whitenoise.django'

I have whitenoise 5.1.0 installed, but can't figure out how to install whitenoise.django or what the issue is.我安装了 whitenoise 5.1.0,但不知道如何安装 whitenoise.django 或问题所在。 Any ideas?有任何想法吗?

wsgi.py wsgi.py

from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)

This is legacy/old way of dealing with whitenoise you should configure it properly configuration这是处理白噪声的传统/旧方式,您应该正确 配置

settings.py设置.py

 MIDDLEWARE_CLASSES = ( # Simplified static file serving. # https://warehouse.python.org/project/whitenoise/ 'whitenoise.middleware.WhiteNoiseMiddleware', ... STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM