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

标签 python-3.x heroku flask

在 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/

相关文章:

Python Matplotlib X轴标签双轴与数据框

python - git push heroku master - 无法编译Python应用程序

ruby-on-rails - 从 heroku 下载部分数据库

python - 无法在 Flask 中导入 LoginManager()

python - 手动更改 Flask Babel 语言

python - 即使答案错误,Python 的分数也会增加

python - 以 pythonic 方式使用 i > j ( > k) 迭代多个索引

python - 猎鹰,属性错误 : 'API' object has no attribute 'create'

database - Heroku 和数据库图形用户界面

port - Python Flask服务器将另一个端口添加到域