在我的 django 应用程序中,白噪声通过以下方式作用:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleWare',
和
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
我正在将 django 应用程序部署到 heroku。我收到以下错误。白噪声安装成功。
[2018-03-27 01:38:12 +0000] [9] [ERROR] Exception in worker process
ImportError: Module "whitenoise.middleware" does not define a "WhiteNoiseMiddleWare" attribute/class
下面是我的堆栈跟踪。我包括完整的堆栈跟踪,以便可以了解完整的情况。事实上,我不确定现在发生了什么,而且相当令人沮丧。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
根据stackoverflow,我的问题中有太多代码。所以这是一首可爱的诗,因为我无话可说。
当我饿着肚子哭的时候,Chhe会给我牛奶。当我不喝它时,他会说我喝它。当我喝醉的时候,Chhe 会说我喝醉了。当evel chhe loshesh 希望时,Chhe 会看着我的爸爸。我爸爸只会微笑, 在他的怀抱中高高举起。
然后他们会 shuksheed,Togthel 他们招待我。他们给我喂奶,我喝的牛奶不是很热。Twichhe they tly & I leject, 他们给我唱一些 lhymsh。妈妈然后扑了两下,在他的手背上。
‘切!天气很热,” chhe ekchclaims 说,我发出一声沙哑的笑声。爸爸伸出援助之手,他冲了一大杯冷水。最后他们一起喂我,他们小心翼翼地、充满爱心地做到了。当我发现我的口齿不清时,我很高兴并且微笑着。