3

I’m hoping to deploy a flask app to Heroku using a free dyno and it seems to build successfully:

remote: Git submodules detected, installing:
remote: 
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote: 
remote: -----> Compressing...
remote:        Done: 83.2M
remote: -----> Launching...
remote:        Released v94
remote:        https://MYAPP.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.

then checking the Heroku logs after accessing the URL i’m thrown this error:

2017-10-25T22:33:09.264449+00:00 heroku[web.1]: Starting process with command `python run.py runserver`
2017-10-25T22:33:15.514250+00:00 app[web.1]:  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2017-10-25T22:33:15.519730+00:00 app[web.1]:  * Restarting with stat
2017-10-25T22:33:17.300082+00:00 app[web.1]:  * Debugger is active!
2017-10-25T22:33:17.305442+00:00 app[web.1]:  * Debugger pin code: 146-142-273
2017-10-25T22:34:09.286891+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-10-25T22:34:09.286934+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-10-25T22:34:09.469418+00:00 heroku[web.1]: Process exited with status 137
2017-10-25T22:34:09.484569+00:00 heroku[web.1]: State changed from starting to crashed

All others who have encountered this in various help sites solve their problem when binding to the Heroku $PORT, the same as how I do it:

#!venv/bin/python
import os
from app import app
port = int(os.environ.get('PORT', 33507))
app.run(host='0.0.0.0', port=port, debug=False)

And my Procfile:

web: python run.py runserver

Could it be that i’m running a virtual environment? Perhaps my app at 83.2M is too large? I’m kind of stuck here. Thanks in advance for your help!

8
  • did you check whether any dynos are running? Commented Oct 25, 2017 at 23:04
  • I do try checking but isn't that part of the problem? I start the dyno, wait for a bit and then read in the logs Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch Commented Oct 25, 2017 at 23:06
  • try port = int(os.environ.get('PORT', 5000)) . refer to stackoverflow.com/a/13714363/4410922 Commented Oct 25, 2017 at 23:09
  • that has been tried with no success Commented Oct 25, 2017 at 23:10
  • replace the Procfile with web: python ./run.py Commented Oct 25, 2017 at 23:11

2 Answers 2

3

Try changing your Procfile content like this:

web: gunicorn run:app -b "0.0.0.0:$PORT" -w 3

Where run is the name of the main application file denoting run.py

Sign up to request clarification or add additional context in comments.

2 Comments

the -w 3 fixed it for me. could you explain what the -w 3 does?
just realized the -w 3 means 3 workers. I wonder why that fixed it.
0

Try changing:

  • Procfile content should be:

    web: python run.py
    
  • Port Number from 33507 to 8080

  • debug = True.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.