我看到一个“ ModuleNotFoundError:没有名为'flask'的模块”。这使我的应用程序无法在Heroku上加载。我已经在虚拟环境以及系统上安装了flask,但问题仍然存在。当我检查要求时,它表示满意。
这是我的日志
2020-04-24T13:17:39.316886+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2020-04-24T13:17:39.316887+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi 2020-04-24T13:17:39.316887+00:00 app[web.1]: self.callable = self.load() 2020-04-24T13:17:39.316887+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load 2020-04-24T13:17:39.316888+00:00 app[web.1]: return self.load_wsgiapp() 2020-04-24T13:17:39.316888+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp 2020-04-24T13:17:39.316889+00:00 app[web.1]: return util.import_app(self.app_uri) 2020-04-24T13:17:39.316889+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app 2020-04-24T13:17:39.316889+00:00 app[web.1]: __import__(module) 2020-04-24T13:17:39.316890+00:00 app[web.1]: File "/app/app.py", line 2, in <module> 2020-04-24T13:17:39.316890+00:00 app[web.1]: from flask import Flask, render_template, url_for, request, redirect 2020-04-24T13:17:39.316898+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask' 2020-04-24T13:17:39.317183+00:00 app[web.1]: [2020-04-24 13:17:39 +0000] [11] [INFO] Worker exiting (pid: 11) 2020-04-24T13:17:39.441061+00:00 app[web.1]: [2020-04-24 13:17:39 +0000] [4] [INFO] Shutting down: Master 2020-04-24T13:17:39.441187+00:00 app[web.1]: [2020-04-24 13:17:39 +0000] [4] [INFO] Reason: Worker failed to boot. 2020-04-24T13:25:42.000000+00:00 app[api]: Build started by user prakharrathi25@gmail.com 2020-04-24T13:26:50.779076+00:00 heroku[web.1]: State changed from crashed to starting 2020-04-24T13:26:50.551463+00:00 app[api]: Deploy 75ff8400 by user prakharrathi25@gmail.com 2020-04-24T13:26:50.551463+00:00 app[api]: Release v4 created by user prakharrathi25@gmail.com 2020-04-24T13:27:11.485811+00:00 heroku[web.1]: State changed from starting to crashed 2020-04-24T13:27:11.342925+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [4] [INFO] Starting gunicorn 19.9.0 2020-04-24T13:27:11.343731+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [4] [INFO] Listening at: http://0.0.0.0:29934 (4) 2020-04-24T13:27:11.344060+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [4] [INFO] Using worker: sync 2020-04-24T13:27:11.349766+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [10] [INFO] Booting worker with pid: 10 2020-04-24T13:27:11.360106+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [10] [ERROR] Exception in worker process 2020-04-24T13:27:11.360124+00:00 app[web.1]: Traceback (most recent call last): 2020-04-24T13:27:11.360130+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker 2020-04-24T13:27:11.360218+00:00 app[web.1]: worker.init_process() 2020-04-24T13:27:11.360220+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process 2020-04-24T13:27:11.360220+00:00 app[web.1]: self.load_wsgi() 2020-04-24T13:27:11.360220+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi 2020-04-24T13:27:11.360221+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2020-04-24T13:27:11.360230+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi 2020-04-24T13:27:11.360231+00:00 app[web.1]: self.callable = self.load() 2020-04-24T13:27:11.360231+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load 2020-04-24T13:27:11.360231+00:00 app[web.1]: return self.load_wsgiapp() 2020-04-24T13:27:11.360232+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp 2020-04-24T13:27:11.360232+00:00 app[web.1]: return util.import_app(self.app_uri) 2020-04-24T13:27:11.360232+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app 2020-04-24T13:27:11.360233+00:00 app[web.1]: __import__(module) 2020-04-24T13:27:11.360233+00:00 app[web.1]: File "/app/app.py", line 2, in <module> 2020-04-24T13:27:11.360233+00:00 app[web.1]: from flask import Flask, render_template, url_for, request, redirect 2020-04-24T13:27:11.360291+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask' 2020-04-24T13:27:11.360477+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [10] [INFO] Worker exiting (pid: 10) 2020-04-24T13:27:11.392341+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [4] [INFO] Shutting down: Master 2020-04-24T13:27:11.392461+00:00 app[web.1]: [2020-04-24 13:27:11 +0000] [4] [INFO] Reason: Worker failed to boot. 2020-04-24T13:27:12.000000+00:00 app[api]: Build succeeded 2020-04-24T13:28:07.813602+00:00 heroku[web.1]: State changed from crashed to starting 2020-04-24T13:28:24.647126+00:00 heroku[web.1]: State changed from starting to crashed 2020-04-24T13:28:24.442681+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [4] [INFO] Starting gunicorn 19.9.0 2020-04-24T13:28:24.443179+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [4] [INFO] Listening at: http://0.0.0.0:6805 (4) 2020-04-24T13:28:24.443379+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [4] [INFO] Using worker: sync 2020-04-24T13:28:24.447064+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [10] [INFO] Booting worker with pid: 10 2020-04-24T13:28:24.453997+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [10] [ERROR] Exception in worker process 2020-04-24T13:28:24.453998+00:00 app[web.1]: Traceback (most recent call last): 2020-04-24T13:28:24.453998+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker 2020-04-24T13:28:24.453998+00:00 app[web.1]: worker.init_process() 2020-04-24T13:28:24.453998+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process 2020-04-24T13:28:24.453999+00:00 app[web.1]: self.load_wsgi() 2020-04-24T13:28:24.453999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi 2020-04-24T13:28:24.453999+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2020-04-24T13:28:24.453999+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi 2020-04-24T13:28:24.454002+00:00 app[web.1]: self.callable = self.load() 2020-04-24T13:28:24.454002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load 2020-04-24T13:28:24.454002+00:00 app[web.1]: return self.load_wsgiapp() 2020-04-24T13:28:24.454002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp 2020-04-24T13:28:24.454002+00:00 app[web.1]: return util.import_app(self.app_uri) 2020-04-24T13:28:24.454002+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app 2020-04-24T13:28:24.454003+00:00 app[web.1]: __import__(module) 2020-04-24T13:28:24.454003+00:00 app[web.1]: File "/app/app.py", line 2, in <module> 2020-04-24T13:28:24.454003+00:00 app[web.1]: from flask import Flask, render_template, url_for, request, redirect 2020-04-24T13:28:24.454006+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask' 2020-04-24T13:28:24.454171+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [10] [INFO] Worker exiting (pid: 10) 2020-04-24T13:28:24.470439+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [11] [INFO] Booting worker with pid: 11 2020-04-24T13:28:24.476282+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [11] [ERROR] Exception in worker process 2020-04-24T13:28:24.476283+00:00 app[web.1]: Traceback (most recent call last): 2020-04-24T13:28:24.476284+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker 2020-04-24T13:28:24.476284+00:00 app[web.1]: worker.init_process() 2020-04-24T13:28:24.476285+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process 2020-04-24T13:28:24.476285+00:00 app[web.1]: self.load_wsgi() 2020-04-24T13:28:24.476285+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi 2020-04-24T13:28:24.476286+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2020-04-24T13:28:24.476286+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi 2020-04-24T13:28:24.476287+00:00 app[web.1]: self.callable = self.load() 2020-04-24T13:28:24.476287+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load 2020-04-24T13:28:24.476287+00:00 app[web.1]: return self.load_wsgiapp() 2020-04-24T13:28:24.476288+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp 2020-04-24T13:28:24.476289+00:00 app[web.1]: return util.import_app(self.app_uri) 2020-04-24T13:28:24.476289+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app 2020-04-24T13:28:24.476289+00:00 app[web.1]: __import__(module) 2020-04-24T13:28:24.476290+00:00 app[web.1]: File "/app/app.py", line 2, in <module> 2020-04-24T13:28:24.476290+00:00 app[web.1]: from flask import Flask, render_template, url_for, request, redirect 2020-04-24T13:28:24.476295+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask' 2020-04-24T13:28:24.476455+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [11] [INFO] Worker exiting (pid: 11) 2020-04-24T13:28:24.581572+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [4] [INFO] Shutting down: Master 2020-04-24T13:28:24.581678+00:00 app[web.1]: [2020-04-24 13:28:24 +0000] [4] [INFO] Reason: Worker failed to boot. 2020-04-24T13:29:35.587344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flair-prediction-app.herokuapp.com request_id=24015513-f2af-4174-a057-3e0d95406412 fwd="122.162.96.112" dyno= connect= service= status=503 bytes= protocol=https 2020-04-24T13:29:37.330254+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flair-prediction-app.herokuapp.com request_id=8caba2a9-f9ba-4c9b-9bb9-2a66a24044e9 fwd="122.162.96.112" dyno= connect= service= status=503 bytes= protocol=https 2020-04-24T13:30:04.497866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flair-prediction-app.herokuapp.com request_id=2773ad5b-b466-4a23-aa58-96091748fb0f fwd="122.162.96.112" dyno= connect= service= status=503 bytes= protocol=https 2020-04-24T13:31:42.603319+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flair-prediction-app.herokuapp.com request_id=1b9f111c-c505-4796-a2f8-012346ae306a fwd="122.162.96.112" dyno= connect= service= status=503 bytes= protocol=https
答案 0 :(得分:0)
在您的requirements.txt中添加烧瓶
Flask==1.1.1