示例烧瓶应用程序在Heroku中部署时给出错误,错误代码为==错误代码= H10 desc =“应用程序崩溃”,方法= GET路径=“ /”。
Flaskapp.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "<h1> Deployed to Heroku</h1>"
if __name__ == "__main__":
app.run()'''
Pocfile
web : gunicorn flaskapp:app
requirements.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
跟随一些博客,无法解决。请协助
将下面的post中提到的Procfile修改为
web: gunicorn --bind 0.0.0.0:$PORT flaskapp:app