简体   繁体   English

ImportError:模块“ whitenoise.middleware”未定义“ WhiteNoiseMiddleWare”属性/类

[英]ImportError: Module “whitenoise.middleware” does not define a “WhiteNoiseMiddleWare” attribute/class

In my django app white noise is acted on in the following ways: 在我的django应用中,以以下方式作用白噪声:

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleWare',

and

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

I am deploying a django application to heroku. 我正在将Django应用程序部署到heroku。 I am getting the following errors. 我收到以下错误。 White noise is installed successfully. 白噪声安装成功。

[2018-03-27 01:38:12 +0000] [9] [ERROR] Exception in worker process

ImportError: Module "whitenoise.middleware" does not define a "WhiteNoiseMiddleWare" attribute/class

with my stack trace below. 与我下面的堆栈跟踪。 I am including the full stacktrace so that the full situation can be appreciated. 我包括完整的stacktrace,以便可以了解完整的情况。 In truth I am not sure what is going on right now and its rather fustrating. 实际上,我不确定现在正在发生什么,而且还很陈旧。 Heroku as been fighting me all day. Heroku一整天都在和我战斗。

File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 244, in handle_chld
2018-03-27T01:38:04.953208+00:00 app[web.1]:     self.reap_workers()
2018-03-27T01:38:04.953232+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 524, in reap_workers
2018-03-27T01:38:04.953390+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2018-03-27T01:38:04.953555+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2018-03-27T01:38:05.121702+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-27T01:38:05.123683+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-27T01:38:05.074667+00:00 heroku[web.1]: Process exited with status 1
2018-03-27T01:38:10.266716+00:00 heroku[web.1]: Starting process with command `gunicorn suitsandtables.wsgi`
2018-03-27T01:38:11.983802+00:00 app[web.1]: [2018-03-27 01:38:11 +0000] [4] [INFO] Starting gunicorn 19.7.1
2018-03-27T01:38:11.984195+00:00 app[web.1]: [2018-03-27 01:38:11 +0000] [4] [INFO] Listening at: http://0.0.0.0:22820 (4)
2018-03-27T01:38:11.989226+00:00 app[web.1]: [2018-03-27 01:38:11 +0000] [9] [INFO] Booting worker with pid: 9
2018-03-27T01:38:11.984378+00:00 app[web.1]: [2018-03-27 01:38:11 +0000] [4] [INFO] Using worker: sync
2018-03-27T01:38:12.228871+00:00 app[web.1]:   """)
2018-03-27T01:38:12.085054+00:00 app[web.1]: [2018-03-27 01:38:12 +0000] [11] [INFO] Booting worker with pid: 11
2018-03-27T01:38:12.228867+00:00 app[web.1]: /app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2018-03-27T01:38:12.322208+00:00 app[web.1]: [2018-03-27 01:38:12 +0000] [9] [ERROR] Exception in worker process
2018-03-27T01:38:12.322248+00:00 app[web.1]: Traceback (most recent call last):
2018-03-27T01:38:12.322251+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
2018-03-27T01:38:12.322253+00:00 app[web.1]:     worker.init_process()
2018-03-27T01:38:12.322255+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
2018-03-27T01:38:12.322257+00:00 app[web.1]:     self.load_wsgi()
2018-03-27T01:38:12.322258+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
2018-03-27T01:38:12.322260+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2018-03-27T01:38:12.322262+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-03-27T01:38:12.322264+00:00 app[web.1]:     self.callable = self.load()
2018-03-27T01:38:12.322265+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-03-27T01:38:12.322267+00:00 app[web.1]:     return self.load_wsgiapp()
2018-03-27T01:38:12.322268+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-03-27T01:38:12.322270+00:00 app[web.1]:     return util.import_app(self.app_uri)
2018-03-27T01:38:12.322272+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
2018-03-27T01:38:12.322273+00:00 app[web.1]:     __import__(module)
2018-03-27T01:38:12.322275+00:00 app[web.1]:   File "/app/suitsandtables/wsgi.py", line 18, in <module>
2018-03-27T01:38:12.322277+00:00 app[web.1]:     application = get_wsgi_application()
2018-03-27T01:38:12.322280+00:00 app[web.1]:     return WSGIHandler()
2018-03-27T01:38:12.322279+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2018-03-27T01:38:12.322282+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
2018-03-27T01:38:12.322283+00:00 app[web.1]:     self.load_middleware()
2018-03-27T01:38:12.322285+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
2018-03-27T01:38:12.322287+00:00 app[web.1]:     middleware = import_string(middleware_path)
2018-03-27T01:38:12.322289+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/module_loading.py", line 27, in import_string
2018-03-27T01:38:12.322291+00:00 app[web.1]:     six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
2018-03-27T01:38:12.322292+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/module_loading.py", line 23, in import_string
2018-03-27T01:38:12.322294+00:00 app[web.1]:     return getattr(module, class_name)
2018-03-27T01:38:12.322296+00:00 app[web.1]: ImportError: Module "whitenoise.middleware" does not define a "WhiteNoiseMiddleWare" attribute/class
2018-03-27T01:38:12.322297+00:00 app[web.1]: [2018-03-27 01:38:12 +0000] [9] [INFO] Worker exiting (pid: 9)
2018-03-27T01:38:12.334355+00:00 app[web.1]: /app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2018-03-27T01:38:12.334361+00:00 app[web.1]:   """)
2018-03-27T01:38:12.428859+00:00 app[web.1]: [2018-03-27 01:38:12 +0000] [11] [ERROR] Exception in worker process
2018-03-27T01:38:12.428864+00:00 app[web.1]: Traceback (most recent call last):
2018-03-27T01:38:12.428874+00:00 app[web.1]:     worker.init_process()
2018-03-27T01:38:12.428869+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
2018-03-27T01:38:12.428876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
2018-03-27T01:38:12.428878+00:00 app[web.1]:     self.load_wsgi()
2018-03-27T01:38:12.428879+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
2018-03-27T01:38:12.428881+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2018-03-27T01:38:12.428884+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-03-27T01:38:12.428885+00:00 app[web.1]:     self.callable = self.load()
2018-03-27T01:38:12.428887+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-03-27T01:38:12.428889+00:00 app[web.1]:     return self.load_wsgiapp()
2018-03-27T01:38:12.428891+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-03-27T01:38:12.428892+00:00 app[web.1]:     return util.import_app(self.app_uri)
2018-03-27T01:38:12.428894+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
2018-03-27T01:38:12.428896+00:00 app[web.1]:     __import__(module)
2018-03-27T01:38:12.428898+00:00 app[web.1]:   File "/app/suitsandtables/wsgi.py", line 18, in <module>
2018-03-27T01:38:12.428900+00:00 app[web.1]:     application = get_wsgi_application()
2018-03-27T01:38:12.428901+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2018-03-27T01:38:12.428903+00:00 app[web.1]:     return WSGIHandler()
2018-03-27T01:38:12.428904+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
2018-03-27T01:38:12.428906+00:00 app[web.1]:     self.load_middleware()
2018-03-27T01:38:12.428911+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
2018-03-27T01:38:12.428913+00:00 app[web.1]:     middleware = import_string(middleware_path)
2018-03-27T01:38:12.428914+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/module_loading.py", line 27, in import_string
2018-03-27T01:38:12.428916+00:00 app[web.1]:     six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
2018-03-27T01:38:12.428918+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/module_loading.py", line 23, in import_string
2018-03-27T01:38:12.428919+00:00 app[web.1]:     return getattr(module, class_name)
2018-03-27T01:38:12.428921+00:00 app[web.1]: ImportError: Module "whitenoise.middleware" does not define a "WhiteNoiseMiddleWare" attribute/class
2018-03-27T01:38:12.428929+00:00 app[web.1]: [2018-03-27 01:38:12 +0000] [11] [INFO] Worker exiting (pid: 11)
2018-03-27T01:38:12.466856+00:00 app[web.1]: Traceback (most recent call last):
2018-03-27T01:38:12.466859+00:00 app[web.1]:   File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2018-03-27T01:38:12.466931+00:00 app[web.1]:     sys.exit(run())
2018-03-27T01:38:12.467000+00:00 app[web.1]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2018-03-27T01:38:12.466940+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2018-03-27T01:38:12.467006+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 203, in run
2018-03-27T01:38:12.467075+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2018-03-27T01:38:12.467069+00:00 app[web.1]:     super(Application, self).run()
2018-03-27T01:38:12.467107+00:00 app[web.1]:     Arbiter(self).run()
2018-03-27T01:38:12.467112+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 231, in run
2018-03-27T01:38:12.467162+00:00 app[web.1]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2018-03-27T01:38:12.467164+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 344, in halt
2018-03-27T01:38:12.467225+00:00 app[web.1]:     self.stop()
2018-03-27T01:38:12.467230+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 393, in stop
2018-03-27T01:38:12.467293+00:00 app[web.1]:     time.sleep(0.1)
2018-03-27T01:38:12.467295+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 244, in handle_chld
2018-03-27T01:38:12.467347+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 524, in reap_workers
2018-03-27T01:38:12.467344+00:00 app[web.1]:     self.reap_workers()
2018-03-27T01:38:12.467425+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2018-03-27T01:38:12.467482+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2018-03-27T01:38:12.543505+00:00 heroku[web.1]: Process exited with status 1
2018-03-27T01:38:12.564292+00:00 heroku[web.1]: State changed from starting to crashed

I have too much code in my question according to stackoverflow. 根据stackoverflow,我的问题中有太多代码。 So here is a cute poem since I have nothing else to say. 所以这是一首可爱的诗,因为我无话可说。

Whenevel I clied hungly, Chhe would give me milk. 每当我饿死时,Ch都会给我牛奶。 Whenevel I do not dlink it, Chhe will tly that I dlink it. 当我不眨眼时,他会提示我眨眼。 Whenevel I am chho angly, Chhe will tly that I dlunk it. 每当我vel不安时,Ch都会劝我我喝醉。 Whenevel chhe loshesh hope, Chhe will look at my papa. 当希望这个希望时,他会看着我的爸爸。 My daddy will only shmile, Lift shweetly in hiz armsh. 我的父亲只会开怀大笑。

They would then shuksheed, Togethel they enteltain me. 然后,他们会shuksheed,togethel,他们招待我。 They dichhtract & feed me, Milk I lyk not chho vely hot. 他们干脆喂我,我不喝牛奶。 Twichhe they tly & I leject, They sing me some lhymsh. 他们齐心协力,我兴高采烈,他们为我唱歌。 Mom then poulsh two dlops, On back of hel hand chhe tlies. 然后,妈妈吐出两个下水道。

'Tsch! 'Tsch! It's hot,' chhe ekchclaims, I let out a shmall shlieky laugh. 天气很热,”这些人喊道,我发出了一点谦逊的笑声。 Daddy lent hel a helping hand, He blung a khup of cold watel. 爸爸伸出了援助之手,他猛击了一口冷水。 Finally they togethel feed me, Calefully & lovingly they do it. 最终,他们相依为命地喂饱了我,他们做到了。 Whenevel I lemembel my lisp, I am chho happy & smile bloadly. 当我抚摸自己的口气时,我很快乐,笑容满面。

'whitenoise.middleware.WhiteNoiseMiddleWare',

should be 应该

'whitenoise.middleware.WhiteNoiseMiddleware',

make the W lower case to w. 使W小写为w。

暂无
暂无

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

相关问题 尝试使用白噪声并得到以下“错误ImportError:没有名为&#39;whitenoise.middleware&#39;的模块” - Tried using white noise and got the following “error ImportError: No module named 'whitenoise.middleware' ” Django ImportError:模块未定义属性/类 - Django ImportError: Module does not define attribute/class 配置不当:中间件模块“ django.middleware”未定义“ doc”类 - ImproperlyConfigured: Middleware module “django.middleware” does not define a “doc” class Django 1.8:ImproperlyConfigured:模块“django.contrib.auth.middleware”没有定义“SessionAuthenticationMiddleware”属性/类 - Django 1.8: ImproperlyConfigured: Module “django.contrib.auth.middleware” does not define a “SessionAuthenticationMiddleware” attribute/class 不正确的配置:中间件模块“django.middleware.csrf”没有定义“CsrfResponseMiddleware”类 - ImproperlyConfigured: Middleware module “django.middleware.csrf” does not define a “CsrfResponseMiddleware” class ImportError:动态模块没有定义init函数 - ImportError: dynamic module does not define init function ImportError: 动态模块没有定义模块导出 function 和 docker - ImportError: dynamic module does not define module export function with docker 无法解决“ ImportError:动态模块未定义模块导出功能” - Unable to solve “ImportError: dynamic module does not define module export function” Django ImportError:没有名为中间件的模块 - Django ImportError: No module named middleware ImportError:动态模块没有定义init函数,但确实如此 - ImportError: dynamic module does not define init function, but it does
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM