How to change Django port
Nov 10, 2020
There are instances we have to change the running port of a django project. There are two ways of doing that.
- Give the port when you run it.
python manage.py runserver 8000
or if you are using python3.
python3 manage.py runserver 8000
2. Add it to the configuration file.
Add the port to manage.py
file.
from django.core.management.commands.runserver import Command as runserver
runserver.default_port = "8000"
Hopefully this is helpful.
If you have found this helpful please hit that 👏 and share it on social media :).