Deploying Python 3 App Heroku: Crashing Deploying Python 3 App Heroku: Crashing flask flask

Deploying Python 3 App Heroku: Crashing


Steps to deploy:

1) Procfile contains: web: gunicorn application:app

2) In requirements.txt type: gunicorn


Based on the code you posted on GitHub, there are a few changes I would suggest to overcome this error:

  1. Add the following to the end of your python program:

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

    make sure that app is defined (it seems to be in your case), and that you do not specify a port parameter in the .run() method. Heroku will crash if you define a port number in advance.

  2. Make sure all dependencies are specified in requirements.txt. Make sure that your Procfile and requirements are properly stated as @James Goldstein defined.

  3. Some web servers such as Azure require the python app to be named app.py by default. I do not know if this is the case with Heroku, but for some servers this could be an issue.