2

私のジャンゴアプリでは、ホワイトノイズは次のように作用します:

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

以下の私のスタックトレースで。完全な状況を理解できるように、完全なスタックトレースを含めています。実のところ、今何が起こっているのかわからず、かなりイライラしています。ヘロクは一日中私と戦っていました。

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は私がそれを飲んだことを認めます。彼が希望を失ったとき、彼は私のパパを見るだろう. 私のパパは微笑むだけです、ヒズアームシュで小声で持ち上げます。

それから彼らはシュクシードし、一緒に私を楽しませました。彼らは私を搾り取って食べさせます。彼らはtlyと私は拒否しますが、彼らは私にいくつかのリズムを歌ってくれます。ママはそれから 2 滴を吐き出します。

「チッ!暑いよ」と、私は小さく陰気な笑い声を上げた。パパは彼に救いの手を差し伸べ、彼は冷たい水を 1 杯吹きました。最後に、彼らは一緒に私に餌をやります。私がリスプを思い出したとき、私はとても幸せで、ひどく微笑んでいます。

4

1 に答える 1