The sample flask app is giving error at=error code=H10 desc="App crashed" method=GET path="/" while deploying in Heroku.
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
error log below
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
followed some blogs and couldnt solve. Please assist
Missing Required Scripts This error is thrown in a Node. js environment if you forget to set a start script . Heroku uses this script to start your app so if it is missing, it would throw an H10-App crashed error code message.
In this tutorial, you'll create a Python Flask example application and deploy it using Heroku, making it publicly available on the web. Heroku removes much of the infrastructure burden related to building and running web applications, allowing you to focus on creating an awesome app.
Modified the Procfile as mentioned in the below post to
web: gunicorn --bind 0.0.0.0:$PORT flaskapp:app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With