heroku日志--tail> ModuleNotFoundError:上没有名为'whitenoise'的模块

时间:2020-07-21 07:11:57

标签: python django heroku deployment whitenoise

这些问题似乎并没有引起太大的注意,但是我还是想尝试一下。 我很难在heroku上部署带有一些静态文件的网站。部署进行得很好,但是当我运行heroku日志--tail时,这就是我得到的:

heroku logs --tail                                                                                                                                [(ruby-2.7.0)]
2020-07-21T06:57:52.130087+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2020-07-21T06:57:52.130087+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2020-07-21T06:57:52.130088+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2020-07-21T06:57:52.130088+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2020-07-21T06:57:52.130088+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 783, in exec_module
2020-07-21T06:57:52.130088+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-07-21T06:57:52.130089+00:00 app[web.1]: File "/app/mywebsite/wsgi.py", line 16, in <module>
2020-07-21T06:57:52.130089+00:00 app[web.1]: application = get_wsgi_application()
2020-07-21T06:57:52.130089+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-07-21T06:57:52.130090+00:00 app[web.1]: django.setup(set_prefix=False)
2020-07-21T06:57:52.130090+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
2020-07-21T06:57:52.130090+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2020-07-21T06:57:52.130090+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
2020-07-21T06:57:52.130091+00:00 app[web.1]: app_config = AppConfig.create(entry)
2020-07-21T06:57:52.130091+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/config.py", line 116, in create
2020-07-21T06:57:52.130091+00:00 app[web.1]: mod = import_module(mod_path)
2020-07-21T06:57:52.130092+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
2020-07-21T06:57:52.130092+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-07-21T06:57:52.130092+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2020-07-21T06:57:52.130092+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2020-07-21T06:57:52.130093+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
2020-07-21T06:57:52.130093+00:00 app[web.1]: ModuleNotFoundError: No module named 'whitenoise'
2020-07-21T06:57:52.130217+00:00 app[web.1]: [2020-07-21 06:57:52 +0000] [9] [INFO] Worker exiting (pid: 9)
2020-07-21T06:57:52.130709+00:00 app[web.1]: [2020-07-21 06:57:52 +0000] [10] [ERROR] Exception in worker process
2020-07-21T06:57:52.130709+00:00 app[web.1]: Traceback (most recent call last):
2020-07-21T06:57:52.130710+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-07-21T06:57:52.130710+00:00 app[web.1]: worker.init_process()
2020-07-21T06:57:52.130710+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-07-21T06:57:52.130710+00:00 app[web.1]: self.load_wsgi()
2020-07-21T06:57:52.130711+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-07-21T06:57:52.130711+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-07-21T06:57:52.130711+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-07-21T06:57:52.130712+00:00 app[web.1]: self.callable = self.load()
2020-07-21T06:57:52.130712+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-07-21T06:57:52.130712+00:00 app[web.1]: return self.load_wsgiapp()
2020-07-21T06:57:52.130713+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-07-21T06:57:52.130713+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-07-21T06:57:52.130713+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2020-07-21T06:57:52.130713+00:00 app[web.1]: mod = importlib.import_module(module)
2020-07-21T06:57:52.130714+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
2020-07-21T06:57:52.130714+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-07-21T06:57:52.130714+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2020-07-21T06:57:52.130714+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2020-07-21T06:57:52.130715+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2020-07-21T06:57:52.130715+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2020-07-21T06:57:52.130715+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 783, in exec_module
2020-07-21T06:57:52.130715+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-07-21T06:57:52.130715+00:00 app[web.1]: File "/app/mywebsite/wsgi.py", line 16, in <module>
2020-07-21T06:57:52.130716+00:00 app[web.1]: application = get_wsgi_application()
2020-07-21T06:57:52.130716+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-07-21T06:57:52.130716+00:00 app[web.1]: django.setup(set_prefix=False)
2020-07-21T06:57:52.130716+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
2020-07-21T06:57:52.130716+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2020-07-21T06:57:52.130717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
2020-07-21T06:57:52.130717+00:00 app[web.1]: app_config = AppConfig.create(entry)
2020-07-21T06:57:52.130717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/config.py", line 116, in create
2020-07-21T06:57:52.130717+00:00 app[web.1]: mod = import_module(mod_path)
2020-07-21T06:57:52.130717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
2020-07-21T06:57:52.130718+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-07-21T06:57:52.130718+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2020-07-21T06:57:52.130718+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2020-07-21T06:57:52.130718+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
2020-07-21T06:57:52.130719+00:00 app[web.1]: ModuleNotFoundError: No module named 'whitenoise'
2020-07-21T06:57:52.130880+00:00 app[web.1]: [2020-07-21 06:57:52 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-07-21T06:57:52.180399+00:00 app[web.1]: Traceback (most recent call last):
2020-07-21T06:57:52.180407+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 209, in run
2020-07-21T06:57:52.180698+00:00 app[web.1]: self.sleep()
2020-07-21T06:57:52.180701+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 357, in sleep
2020-07-21T06:57:52.180919+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2020-07-21T06:57:52.180921+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-07-21T06:57:52.181136+00:00 app[web.1]: self.reap_workers()
2020-07-21T06:57:52.181139+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-07-21T06:57:52.181403+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-07-21T06:57:52.181454+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-07-21T06:57:52.181458+00:00 app[web.1]:
2020-07-21T06:57:52.181458+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2020-07-21T06:57:52.181459+00:00 app[web.1]:
2020-07-21T06:57:52.181508+00:00 app[web.1]: Traceback (most recent call last):
2020-07-21T06:57:52.181509+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2020-07-21T06:57:52.181677+00:00 app[web.1]: sys.exit(run())
2020-07-21T06:57:52.181678+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2020-07-21T06:57:52.181817+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-07-21T06:57:52.181822+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, in run
2020-07-21T06:57:52.182014+00:00 app[web.1]: super().run()
2020-07-21T06:57:52.182018+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run
2020-07-21T06:57:52.182140+00:00 app[web.1]: Arbiter(self).run()
2020-07-21T06:57:52.182141+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 229, in run
2020-07-21T06:57:52.182300+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2020-07-21T06:57:52.182300+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt
2020-07-21T06:57:52.182495+00:00 app[web.1]: self.stop()
2020-07-21T06:57:52.182496+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop
2020-07-21T06:57:52.182696+00:00 app[web.1]: time.sleep(0.1)
2020-07-21T06:57:52.182697+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-07-21T06:57:52.182860+00:00 app[web.1]: self.reap_workers()
2020-07-21T06:57:52.182860+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-07-21T06:57:52.183087+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-07-21T06:57:52.183108+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-07-21T06:57:52.241392+00:00 heroku[web.1]: Process exited with status 1
2020-07-21T06:57:52.272138+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-21T06:57:54.000000+00:00 app[api]: Build succeeded

我该如何解决?已安装whitenoise并正确编写了require.txt。

0 个答案:

没有答案