Flask web app crashes in Heroku, is fine in my computer server

Viewed 95

It was find when it was a simple "Hello world" web, but I want to add this Dash-pivottable from plotly and it doen't work. I get this error in the Heroku logs:

at=error code=H10 desc="App crashed" method=GET path="/" host=flasktabla.herokuapp.com request_id=** fwd="201.239.88.79" dyno=web.1 connect=5001ms service= status=503 bytes= protocol=https

app.py:

from flask import Flask
import dash
import dash_html_components as html
import dash_pivottable

server = Flask(__name__)

app = dash.Dash(__name__) 
server = app.server

app.layout = html.Div(
    dash_pivottable.PivotTable(
        data=[
            ['Animal', 'Count', 'Location'],
            ['Zebra', 5, 'SF Zoo'],
            ['Tiger', 3, 'SF Zoo'],
            ['Zebra', 2, 'LA Zoo'],
            ['Tiger', 4, 'LA Zoo'],
        ],
        cols=["Animal"],
        rows=["Location"],
        vals=["Count"]
    )
)

if __name__ == "__main__":
    app.run_server(debug=True)

@server.route("/")
def my_dash_app():
    return app.index()

requirements.txt:

Click==7.1.2
Flask==1.1.2
gunicorn==20.1.0
itsdangerous==1.1.0
Jinja2==2.11.3
MarkupSafe==1.1.1
Werkzeug==1.0.1
dash-pivottable==0.0.2

Procfile:

web: gunicorn app:app

Thanks.

1 Answers

This is probably a error in your Procfile. Change your Procfile to this:

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