我正在尝试将django应用程序部署到heroku,并且一直收到
2020-06-07T13:43:58.422709+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-07T13:44:02.573617+00:00 heroku[web.1]: Starting process with command `gunicorn --pythonpath frolicaide frolicaide.wsgi`
2020-06-07T13:44:04.912297+00:00 heroku[web.1]: Process exited with status 3
2020-06-07T13:44:04.953057+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-07T13:44:04.706207+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-06-07T13:44:04.706710+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [4] [INFO] Listening at: http://0.0.0.0:4939 (4)
2020-06-07T13:44:04.706805+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [4] [INFO] Using worker: sync
2020-06-07T13:44:04.710715+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [10] [INFO] Booting worker with pid: 10
2020-06-07T13:44:04.715576+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [10] [ERROR] Exception in worker process
2020-06-07T13:44:04.715577+00:00 app[web.1]: Traceback (most recent call last):
2020-06-07T13:44:04.715593+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-06-07T13:44:04.715593+00:00 app[web.1]: worker.init_process()
2020-06-07T13:44:04.715593+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-06-07T13:44:04.715594+00:00 app[web.1]: self.load_wsgi()
2020-06-07T13:44:04.715594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-06-07T13:44:04.715594+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-06-07T13:44:04.715594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-07T13:44:04.715594+00:00 app[web.1]: self.callable = self.load()
2020-06-07T13:44:04.715595+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-06-07T13:44:04.715595+00:00 app[web.1]: return self.load_wsgiapp()
2020-06-07T13:44:04.715595+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-06-07T13:44:04.715595+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-06-07T13:44:04.715595+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-06-07T13:44:04.715596+00:00 app[web.1]: mod = importlib.import_module(module)
2020-06-07T13:44:04.715596+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-06-07T13:44:04.715596+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-06-07T13:44:04.715596+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-07T13:44:04.715596+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-07T13:44:04.715597+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
2020-06-07T13:44:04.715597+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-06-07T13:44:04.715597+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-07T13:44:04.715597+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-07T13:44:04.715597+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2020-06-07T13:44:04.715600+00:00 app[web.1]: ModuleNotFoundError: No module named 'frolicaide'
2020-06-07T13:44:04.715708+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-06-07T13:44:04.720294+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [11] [INFO] Booting worker with pid: 11
2020-06-07T13:44:04.725269+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [11] [ERROR] Exception in worker process
2020-06-07T13:44:04.725270+00:00 app[web.1]: Traceback (most recent call last):
2020-06-07T13:44:04.725271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-06-07T13:44:04.725272+00:00 app[web.1]: worker.init_process()
2020-06-07T13:44:04.725272+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-06-07T13:44:04.725273+00:00 app[web.1]: self.load_wsgi()
2020-06-07T13:44:04.725273+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-06-07T13:44:04.725273+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-06-07T13:44:04.725274+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-07T13:44:04.725274+00:00 app[web.1]: self.callable = self.load()
2020-06-07T13:44:04.725275+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-06-07T13:44:04.725275+00:00 app[web.1]: return self.load_wsgiapp()
2020-06-07T13:44:04.725275+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-06-07T13:44:04.725276+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-06-07T13:44:04.725276+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-06-07T13:44:04.725277+00:00 app[web.1]: mod = importlib.import_module(module)
2020-06-07T13:44:04.725277+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-06-07T13:44:04.725277+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-06-07T13:44:04.725278+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-07T13:44:04.725278+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-07T13:44:04.725279+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
2020-06-07T13:44:04.725279+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-06-07T13:44:04.725280+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-06-07T13:44:04.725280+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-06-07T13:44:04.725280+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2020-06-07T13:44:04.725285+00:00 app[web.1]: ModuleNotFoundError: No module named 'frolicaide'
2020-06-07T13:44:04.725430+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-06-07T13:44:04.844134+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [4] [INFO] Shutting down: Master
2020-06-07T13:44:04.844221+00:00 app[web.1]: [2020-06-07 13:44:04 +0000] [4] [INFO] Reason: Worker failed to boot.
这是我的项目结构:
Procfile:
release: python src/frolicaide/manage.py migrate
web: gunicorn --pythonpath frolicaide frolicaide.wsgi
还有wsgi.py:
import os
from django.core.wsgi import get_wsgi_application
from whitenoise import WhiteNoise
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'frolicaide.settings')
application = get_wsgi_application()
application = WhiteNoise(application)
请帮助...我不明白为什么它一直告诉我ModuleNotFoundError:没有名为'frolicaide'的模块。我尝试以任何可能的方式从Procfile切换路径。现在真的不知道我还能做什么。
答案 0 :(得分:0)
您有一个额外的目录层。 manage.py
,您的项目目录和所有应用程序目录应位于.git/
文件夹旁边的根目录中。
将所有内容从src/frolicaide/
移到src/
,提交并重新部署。