如何使用女服务员和 heroku 部署 Flask 应用程序?
How to deploy Flask app using waitress and heroku?
我已成功部署 Flask 应用程序,但是当我单击 herokuapp link 时出现应用程序错误。当我检查日志时,它显示类似这样的内容
2022-01-03T12:52:35.000000+00:00 app[api]: Build started by user
2022-01-03T12:53:02.508102+00:00 app[api]: Deploy 8a785469 by user
2022-01-03T12:53:02.508102+00:00 app[api]: Release v4 created by user
2022-01-03T12:53:03.794631+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-03T12:53:07.748702+00:00 heroku[web.1]: Starting process with command `waitress-serve --call flaskr:create_app`
2022-01-03T12:53:09.003519+00:00 app[web.1]: INFO:waitress:Serving on http://0.0.0.0:8080
2022-01-03T12:53:12.000000+00:00 app[api]: Build succeeded
2022-01-03T12:54:08.177780+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-01-03T12:54:08.255635+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-01-03T12:54:08.406812+00:00 heroku[web.1]: Process exited with status 137
我也用过heroku ps:scale web=1
我的 Procfile 包括:
web: waitress-serve --call flaskr:create_app
您必须提供要绑定的端口(不能使用默认的 8080)
web: waitress-serve --port=$PORT --call 'flaskr:create_app'