在 heroku 中部署 Flask Webapp 的问题
issue deploying a Flask Webapp in heroku
我刚刚完成我的第一个 flask webapp 我尝试将它部署在 python 应用程序启动的任何地方并且 运行ning
但是当我尝试使用 git bash 在 heroku 中部署它时,该应用程序没有 运行。登录并在 heroku 中创建应用程序后,添加 Procfile web: gunicorn app:test
(应用程序名称为 test.py),推送到 git,然后推送到 heroku :
2021-03-15T19:10:00.000000+00:00 app[api]: Build started by user ******@gmail.com
2021-03-15T19:10:28.386752+00:00 app[api]: Deploy c1366dcb by user *******@gmail.com
2021-03-15T19:10:28.386752+00:00 app[api]: Release v8 created by user *******@gmail.com
2021-03-15T19:10:28.443888+00:00 heroku[web.1]: State changed from crashed to down
2021-03-15T19:10:38.000000+00:00 app[api]: Build succeeded
2021-03-15T19:11:18.000000+00:00 app[api]: Build started by user *******@gmail.com
2021-03-15T19:11:48.526535+00:00 app[api]: Deploy 548a41fe by user *******@gmail.com
2021-03-15T19:11:48.526535+00:00 app[api]: Release v9 created by user *******@gmail.com
2021-03-15T19:11:48.538632+00:00 app[api]: Scaled to web@1:Free by user *******@gmail.com
2021-03-15T19:11:53.787271+00:00 heroku[web.1]: Starting process with command `gunicorn app:test`
2021-03-15T19:11:56.701317+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-03-15T19:11:56.702121+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Listening at: http://0.0.0.0:11987 (4)
2021-03-15T19:11:56.702252+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Using worker: sync
2021-03-15T19:11:56.707057+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [INFO] Booting worker with pid: 9
2021-03-15T19:11:56.712761+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [ERROR] Exception in worker process
2021-03-15T19:11:56.712762+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:11:56.712763+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:11:56.712763+00:00 app[web.1]: worker.init_process()
2021-03-15T19:11:56.712764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:11:56.712764+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:11:56.712764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:11:56.712765+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:11:56.712765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:11:56.712766+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:11:56.712766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:11:56.712767+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:11:56.712767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:11:56.712767+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:11:56.712768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:11:56.712768+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:11:56.712768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:11:56.712769+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:11:56.712769+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:11:56.712833+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:11:56.712834+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:11:56.712840+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:11:56.713032+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-15T19:11:56.747578+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Shutting down: Master
2021-03-15T19:11:56.747752+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-15T19:11:56.818562+00:00 heroku[web.1]: Process exited with status 3
2021-03-15T19:11:56.896518+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-15T19:11:56.899674+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-15T19:11:59.000000+00:00 app[api]: Build succeeded
2021-03-15T19:12:03.828677+00:00 heroku[web.1]: Starting process with command `gunicorn app:test`
2021-03-15T19:12:08.787358+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-03-15T19:12:08.788300+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Listening at: http://0.0.0.0:59993 (4)
2021-03-15T19:12:08.788482+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Using worker: sync
2021-03-15T19:12:08.795108+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [INFO] Booting worker with pid: 9
2021-03-15T19:12:08.802437+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [ERROR] Exception in worker process
2021-03-15T19:12:08.802439+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:12:08.802463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:12:08.802464+00:00 app[web.1]: worker.init_process()
2021-03-15T19:12:08.802464+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:12:08.802465+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:12:08.802465+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:12:08.802466+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:12:08.802466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:12:08.802467+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:12:08.802467+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:12:08.802467+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:12:08.802468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:12:08.802468+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:12:08.802468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:12:08.802469+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:12:08.802469+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:12:08.802470+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:12:08.802470+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:12:08.802471+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:12:08.802471+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:12:08.802481+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:12:08.803439+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-15T19:12:08.879652+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [INFO] Booting worker with pid: 10
2021-03-15T19:12:08.915719+00:00 heroku[web.1]: State changed from starting to up
2021-03-15T19:12:08.927761+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [ERROR] Exception in worker process
2021-03-15T19:12:08.927763+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:12:08.927764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:12:08.927765+00:00 app[web.1]: worker.init_process()
2021-03-15T19:12:08.927765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:12:08.927766+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:12:08.927766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:12:08.927767+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:12:08.927767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:12:08.927767+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:12:08.927768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:12:08.927774+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:12:08.927774+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:12:08.927774+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:12:08.927775+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:12:08.927775+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:12:08.927776+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:12:08.927776+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:12:08.927778+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:12:08.929808+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-03-15T19:12:09.058059+00:00 app[web.1]: [2021-03-15 19:12:09 +0000] [4] [INFO] Shutting down: Master
2021-03-15T19:12:09.058191+00:00 app[web.1]: [2021-03-15 19:12:09 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-15T19:12:09.298467+00:00 heroku[web.1]: Process exited with status 3
2021-03-15T19:12:09.406548+00:00 heroku[web.1]: State changed from up to crashed
python 版本:python 3.8
OS:windows10
如果我尝试 gunicorn --version 这是我收到的消息:
$ gunicorn --version
Traceback (most recent call last):
File "c:\users\virus\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\virus\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Virus\AppData\Local\Programs\Python\Python38\Scripts\gunicorn.exe\__main__.py", line 4, in <module>
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\app\wsgiapp.py", line 9, in <module>
from gunicorn.app.base import Application
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\app\base.py", line 11, in <module>
from gunicorn import util
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\util.py", line 9, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
web: gunicorn app:test must be web: gunicorn test:app, it should be in format module:callable @NobbyNobbs
成功了,我第一次使用heroku,请原谅newbee的错误。
我刚刚完成我的第一个 flask webapp 我尝试将它部署在 python 应用程序启动的任何地方并且 运行ning
但是当我尝试使用 git bash 在 heroku 中部署它时,该应用程序没有 运行。登录并在 heroku 中创建应用程序后,添加 Procfile web: gunicorn app:test
(应用程序名称为 test.py),推送到 git,然后推送到 heroku :
2021-03-15T19:10:00.000000+00:00 app[api]: Build started by user ******@gmail.com
2021-03-15T19:10:28.386752+00:00 app[api]: Deploy c1366dcb by user *******@gmail.com
2021-03-15T19:10:28.386752+00:00 app[api]: Release v8 created by user *******@gmail.com
2021-03-15T19:10:28.443888+00:00 heroku[web.1]: State changed from crashed to down
2021-03-15T19:10:38.000000+00:00 app[api]: Build succeeded
2021-03-15T19:11:18.000000+00:00 app[api]: Build started by user *******@gmail.com
2021-03-15T19:11:48.526535+00:00 app[api]: Deploy 548a41fe by user *******@gmail.com
2021-03-15T19:11:48.526535+00:00 app[api]: Release v9 created by user *******@gmail.com
2021-03-15T19:11:48.538632+00:00 app[api]: Scaled to web@1:Free by user *******@gmail.com
2021-03-15T19:11:53.787271+00:00 heroku[web.1]: Starting process with command `gunicorn app:test`
2021-03-15T19:11:56.701317+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-03-15T19:11:56.702121+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Listening at: http://0.0.0.0:11987 (4)
2021-03-15T19:11:56.702252+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Using worker: sync
2021-03-15T19:11:56.707057+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [INFO] Booting worker with pid: 9
2021-03-15T19:11:56.712761+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [ERROR] Exception in worker process
2021-03-15T19:11:56.712762+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:11:56.712763+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:11:56.712763+00:00 app[web.1]: worker.init_process()
2021-03-15T19:11:56.712764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:11:56.712764+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:11:56.712764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:11:56.712765+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:11:56.712765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:11:56.712766+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:11:56.712766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:11:56.712767+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:11:56.712767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:11:56.712767+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:11:56.712768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:11:56.712768+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:11:56.712768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:11:56.712769+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:11:56.712769+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:11:56.712833+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:11:56.712834+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:11:56.712840+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:11:56.713032+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-15T19:11:56.747578+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Shutting down: Master
2021-03-15T19:11:56.747752+00:00 app[web.1]: [2021-03-15 19:11:56 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-15T19:11:56.818562+00:00 heroku[web.1]: Process exited with status 3
2021-03-15T19:11:56.896518+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-15T19:11:56.899674+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-15T19:11:59.000000+00:00 app[api]: Build succeeded
2021-03-15T19:12:03.828677+00:00 heroku[web.1]: Starting process with command `gunicorn app:test`
2021-03-15T19:12:08.787358+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-03-15T19:12:08.788300+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Listening at: http://0.0.0.0:59993 (4)
2021-03-15T19:12:08.788482+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [4] [INFO] Using worker: sync
2021-03-15T19:12:08.795108+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [INFO] Booting worker with pid: 9
2021-03-15T19:12:08.802437+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [ERROR] Exception in worker process
2021-03-15T19:12:08.802439+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:12:08.802463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:12:08.802464+00:00 app[web.1]: worker.init_process()
2021-03-15T19:12:08.802464+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:12:08.802465+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:12:08.802465+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:12:08.802466+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:12:08.802466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:12:08.802467+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:12:08.802467+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:12:08.802467+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:12:08.802468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:12:08.802468+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:12:08.802468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:12:08.802469+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:12:08.802469+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:12:08.802470+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:12:08.802470+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:12:08.802471+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:12:08.802471+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:12:08.802481+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:12:08.803439+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-03-15T19:12:08.879652+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [INFO] Booting worker with pid: 10
2021-03-15T19:12:08.915719+00:00 heroku[web.1]: State changed from starting to up
2021-03-15T19:12:08.927761+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [ERROR] Exception in worker process
2021-03-15T19:12:08.927763+00:00 app[web.1]: Traceback (most recent call last):
2021-03-15T19:12:08.927764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-03-15T19:12:08.927765+00:00 app[web.1]: worker.init_process()
2021-03-15T19:12:08.927765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-03-15T19:12:08.927766+00:00 app[web.1]: self.load_wsgi()
2021-03-15T19:12:08.927766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-03-15T19:12:08.927767+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-03-15T19:12:08.927767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-03-15T19:12:08.927767+00:00 app[web.1]: self.callable = self.load()
2021-03-15T19:12:08.927768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-03-15T19:12:08.927774+00:00 app[web.1]: return self.load_wsgiapp()
2021-03-15T19:12:08.927774+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-03-15T19:12:08.927774+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-03-15T19:12:08.927775+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2021-03-15T19:12:08.927775+00:00 app[web.1]: mod = importlib.import_module(module)
2021-03-15T19:12:08.927776+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2021-03-15T19:12:08.927776+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2021-03-15T19:12:08.927777+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2021-03-15T19:12:08.927778+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-03-15T19:12:08.929808+00:00 app[web.1]: [2021-03-15 19:12:08 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-03-15T19:12:09.058059+00:00 app[web.1]: [2021-03-15 19:12:09 +0000] [4] [INFO] Shutting down: Master
2021-03-15T19:12:09.058191+00:00 app[web.1]: [2021-03-15 19:12:09 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-03-15T19:12:09.298467+00:00 heroku[web.1]: Process exited with status 3
2021-03-15T19:12:09.406548+00:00 heroku[web.1]: State changed from up to crashed
python 版本:python 3.8 OS:windows10
如果我尝试 gunicorn --version 这是我收到的消息:
$ gunicorn --version
Traceback (most recent call last):
File "c:\users\virus\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\virus\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Virus\AppData\Local\Programs\Python\Python38\Scripts\gunicorn.exe\__main__.py", line 4, in <module>
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\app\wsgiapp.py", line 9, in <module>
from gunicorn.app.base import Application
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\app\base.py", line 11, in <module>
from gunicorn import util
File "c:\users\virus\appdata\local\programs\python\python38\lib\site-packages\gunicorn\util.py", line 9, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
web: gunicorn app:test must be web: gunicorn test:app, it should be in format module:callable @NobbyNobbs
成功了,我第一次使用heroku,请原谅newbee的错误。