gpt4 book ai didi

python-3.x - Flask 应用程序在部署到 Heroku 时出错 at=error code=H10 desc ="App crashed"method=GET path ="/"

转载 作者:行者123 更新时间:2023-12-03 14:23:42 24 4
gpt4 key购买 nike

在 Heroku 中部署时,示例 flask 应用程序给出错误 at=error code=H10 desc="App crashed"method=GET path="/"。

flask 应用程序

from flask import Flask

app = Flask(__name__)


@app.route('/')
def index():
return "<h1> Deployed to Heroku</h1>"


if __name__ == "__main__":
app.run()'''

文件
web : gunicorn flaskapp:app

要求.txt
Click==7.0
Flask==1.1.1
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
Werkzeug==0.16.0

下面的错误日志
2020-01-10T10:35:14.658092+00:00 heroku[web.1]: Starting process with command `: gunicorn flaskapp:app`
2020-01-10T10:35:16.404755+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-10T10:35:16.381754+00:00 heroku[web.1]: Process exited with status 0
2020-01-10T10:35:19.000000+00:00 app[api]: Build succeeded
2020-01-10T10:35:38.654704+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=flaskapp-te.herokuapp.com request_id=6712472d-a734-4720-b152-1e2716844c41 fwd="137.97.4.98" dyno= connect= service= status=503 bytes= protocol=https
2020-01-10T10:35:39.689766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=flaskapp-te.herokuapp.com request_id=89a26803-5b09-4a94-99a2-5b0d154d7797 fwd="137.97.4.98" dyno= connect= service= status=503 bytes= protocol=https

关注了一些博客,无法解决。请协助

最佳答案

修改了Procfile,如下面提到的post

web: gunicorn --bind 0.0.0.0:$PORT flaskapp:app

关于python-3.x - Flask 应用程序在部署到 Heroku 时出错 at=error code=H10 desc ="App crashed"method=GET path ="/",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59680256/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com