This is a spin off question from gunicorn on heroku: binding to localhost.
How can I get gunicorn to work both locally (using foreman) and for deployment on Heroku?
Procfile contains:
web: gunicorn mysite.wsgi
When I deploy locally using foreman, gunicorn binds to http://0.0.0.0:5000. I want it to bind to 127.0.0.1:8000. However, if I change to the Procfile to this:
web: gunicorn -b 127.0.0.1:8000 mysite.wsgi
Then I can't deploy to Heroku, the browser will return "application error"
$ heroku ps
=== web (1X): `gunicorn -b 127.0.0.1:8000 mysite.wsgi`
web.1: crashed 2013/08/22 23:45:04 (~ 1m ago)
Where is the default binding address set and/or what gunicorn options do I put in Procfile to get it to work on 127.0.0.1? What could be unique to my situation that causes a deviant default setup (I'm working in mac OS - lion, maybe?)
Dont bind gunicorn to the local ip with.
web: gunicorn -b 127.0.0.1:8000 mysite.wsgiin your procfile. This forces your django app to always use this local port whether or not its deployed locally or on Heroku's servers.Using
in your procfile will make your application deploy at
127.0.0.1:8000locally and0.0.0.0:5000on heroku's severs. I know you had to use the bind method in your previous question to get heroku to work locally, but that method is only covering an issue that isn't resolved.Using
foreman startwithweb: gunicorn mysite.wsgishould work, as told by the official docs (and my own experince :)).Try just
web: gunicorn mysite.wsgiin your procfile, deploy it to heroku and see if it works.https://devcenter.heroku.com/articles/python