Skip to content

Instantly share code, notes, and snippets.

@voznik
Forked from mozz100/runserver.py
Last active June 30, 2018 15:47
Show Gist options
  • Save voznik/5893a47f4b2caf3e28772616f86281d3 to your computer and use it in GitHub Desktop.
Save voznik/5893a47f4b2caf3e28772616f86281d3 to your computer and use it in GitHub Desktop.
Change default port for django runserver
# Put this at <yourapp>/management/commands/runserver.py.
# Override the value of the constant coded into django...
import django.core.management.commands.runserver as runserver
runserver.DEFAULT_ADDR="0.0.0.0"
runserver.DEFAULT_PORT="8080"
# ...and then just import its standard Command class.
# Then manage.py runserver behaves normally in all other regards.
from django.core.management.commands.runserver import Command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment