2
votes

I'm developing an app on Python using flask and I'm getting this error while trying to deploy it to Heroku:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

On the Heroku logs, I can see this line enter image description here

Few possibilities that I have tried

  1. In my Procfile I have written this web: python hello-mysql.py

  2. I have also tried web: python hello-mysql.py runserver 0.0.0.0=$PORT

  3. Replace "web" with "worker" in your Procfile.

1
If you look at your log lines, your app is starting on port 5000. It needs to start on the port set at $PORT - Damien MATHIEU
@DamienMATHIEU I have tried $PORT...but from your point of view can you tell me how it will work? - sheel
It doesn't look like you're using any of the Python standard servers such as gunicorn. So you need to handle the port yourself when booting the server, with os.environ['PORT'] instead of 5000. - Damien MATHIEU

1 Answers

1
votes

To @damien's point, it looks like you're not binding to the $PORT env var. Here's some documentation that may help: https://devcenter.heroku.com/articles/getting-started-with-python#define-a-procfile and https://devcenter.heroku.com/articles/dynos#web-dynos

Also, do not rename your process to "worker" since only processes named web will be accessible via http/https.