How to change Django port

Yashod Perera
Nov 10, 2020

--

Photo by Ibrahim Boran on Unsplash

There are instances we have to change the running port of a django project. There are two ways of doing that.

  1. 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 :).

--

--

Yashod Perera
Yashod Perera

Written by Yashod Perera

Technical Writer | Tech Enthusiast | Open source contributor

No responses yet