yasoob / practical-python-projects

99 stars 43 forks source link

Missing host and port in the app.run results in an error when deploying to Heroku #16

Closed jalvaradosegura closed 3 years ago

jalvaradosegura commented 4 years ago

Location Within the Book

Page: 100 Hint: Page numbers change all the time. The best way to report an issue is by chapter and section numbers.

Description

After doing the deploy to Heroku (Page 103), i was getting this error :

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

Following this answer, the problem got fixed. The problem was that the code is missing the host and the port (line 75 of the code snippet, line 59 in the book).

# Copied from the book (page 100)
58 if __name__ == '__main__':
59     app.run()

Possible Solutions

Add the host and port parameters

# The code i copied and worked for me
if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)

> I noticed this error when i was doing section 6.4, when i was trying to create the webhook

Jorge Alberto Alvarado Segura

yasoob commented 4 years ago

Hey @jalvaradosegura thank you so much for all the bug reports. I will be going over them over the weekend and making sure they are fixed in the next release. I will close these issues once I get the fixes in. :)

jalvaradosegura commented 4 years ago

Hey @yasoob! Im very happy to be able to contribute to the book in this way. Is the first time i do something like this, i find it very cool.

Thanks for the book!

yasoob commented 3 years ago

Hey Jorge, so sorry for such a delayed update. COVID had me struggling for a bit but this bug is fixed in the latest version that will go out soon. Thanks ❤️