Search code examples
djangoheroku

Heroku, Django app crashing on startup, "not a valid port number"


I am trying to run my first Django powered app on Heroku. I have been following this guide. The app is running fine using:

python manage.py runserver

When I commit any changes I made, and then try to push it to Heroku, everything seems fine until I visit the heroku URL. I receive an 'Application Error' page. Looking more in to the:

heroku logs

I get a bunch of what appears to be the same error message:

.......
2013-01-18T05:28:29+00:00 heroku[slugc]: Slug compilation finished
2013-01-18T05:28:29+00:00 app[web.1]: Error: "0.0.0.0:" is not a valid port number        or address:port pair.
2013-01-18T05:28:31+00:00 heroku[web.1]: Process exited with status 1
2013-01-18T05:28:32+00:00 heroku[web.1]: Starting process with command `python      manage.py runserver 0.0.0.0: --noreload`
2013-01-18T05:28:33+00:00 app[web.1]: Error: "0.0.0.0:" is not a valid port number or     address:port pair.

Also if I do a foreman start:

22:39:26 web.1  | started with pid 2499
22:39:26 web.1  | Error: "0.0.0.0:" is not a valid port number or address:port pair.
22:39:26 web.1  | exited with code 1
22:39:26 system | sending SIGTERM to all processes
SIGTERM received

I looked at a similar question but I seem to have everything needed in my requirements.txt file.

Thanks for the help!


Solution

  • It looks like you have something strange in your Procfile. Examine your Procfile and either follow the Heroku instructions for setting up gunicorn (recommended for production), or else add a port number -- presumably 80 -- to your Procfile as so:

    python manage.py runserver 0.0.0.0:80 --noreload