我正在尝试在Heroku网站上运行Flask应用。我一直收到ModuleNotFoundError: No module named 'app'
。这会导致错误H10,这意味着该应用已崩溃。
我在ModuleNotFoundErrors上看到的大多数其他帖子与Heroku无关。
我收到的错误如下所示:
2019-03-26T21:48:51.850467+00:00 app[web.1]: __import__(module)
2019-03-26T21:48:51.850469+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2019-03-26T21:48:51.850619+00:00 app[web.1]: [2019-03-26 21:48:51 +0000]
[10] [INFO] Worker exiting (pid: 10)
2019-03-26T21:48:51.880416+00:00 app[web.1]: [2019-03-26 21:48:51 +0000] [4] [INFO] Shutting down: Master
2019-03-26T21:48:51.880549+00:00 app[web.1]: [2019-03-26 21:48:51 +0000] [4] [INFO] Reason: Worker failed to boot.
2019-03-26T21:48:51.958542+00:00 heroku[web.1]: Process exited with status 3
2019-03-26T21:48:54.000000+00:00 app[api]: Build succeeded
2019-03-26T21:49:27.367113+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-gorge-37718.herokuapp.com request_id=6ca268c7-0b35-4a07-b628-5a7299d12f81 fwd="143.229.174.127" dyno= connect= service= status=503 bytes= protocol=https
2019-03-26T21:49:27.892816+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pure-gorge-37718.herokuapp.com request_id=0c7a5ac6-456c-489a-9eab-cdd94c8c68f2 fwd="143.229.174.127" dyno= connect= service= status=503 bytes= protocol=https
为什么仅当我尝试在Heroku上运行此应用程序时才会出现此错误?
答案 0 :(得分:0)
我通过将Procfile
更改为web: gunicorn app:app
并将所有内容从FaceDetector移到根文件夹来解决了这个问题。