1

I am doing a Heroku tutorial and web: python manage.py runserver 0.0.0.0:$PORT creates the error when I run heroku local or heroku local -p 5000 (or one of several more variants). However, web: python manage.py runserver 0.0.0.0:5000 works fine. I suspect I am making a simple error with how to pass an environment variable into the Procfile.

The error message is: CommandError: "0.0.0.0:$PORT" is not a valid port number or address:port pair.

riemann_lebesgue
  • 299
  • 5
  • 17

1 Answers1

0

The problem was a difference between Windows and Linux. The solution is below for others' benefit.

on linux, $PORT references the variable called PORT

on windows, we instead need %PORT%

Hence, web: python manage.py runserver 0.0.0.0:%PORT% works for Procfile.windows. To run the Windows specific Procfile, run heroku local web -f Procfile.windows as the normal Procfile file should be left with web: python manage.py runserver 0.0.0.0:$PORT so it works when deployed (as heroku machines use linux)

riemann_lebesgue
  • 299
  • 5
  • 17