Reputation: 5051
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!
Upvotes: 3
Views: 770
Reputation: 45
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
Upvotes: 3
Reputation: 13
Try changing:
Procfile content should be:
web: python run.py
Port Number from 33507 to 8080
Upvotes: 0