I am attempting to run a Flask app on a Heroku website. I keep receiving ModuleNotFoundError: No module named 'app'
. Which results in error H10s, which means that the app has crashed.
Most of the other posts that I have seen for ModuleNotFoundErrors do not have to do with Heroku.
The error that I recieved is shown below:
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
Why would this error only occur when I try to run this app on Heroku?
我通过将Procfile
更改为web: gunicorn app:app
并将所有内容从FaceDetector移动到根文件夹来解决了这个问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.