Change default runserver port django

If you wish to run you django server in other than port 8000 here is a solution for you.

SOLUTION-1:

  • Create a bash script like the following
#!/bin/bash
exec ./manage.py runserver 0.0.0.0:<your_port>

Note: change <your_port> with the port number you want.

  • Save it as runserver in the same dir where manage.py is present.
  • and run it as ./runserver.

ALTERNATIVE SOLUTION:

Actually the easiest way to change (only) port in development Django server is just like:

python manage.py runserver <your_port> 

Note: change <your_port> with the port number you want

--

--

--

webdeveloper and programmer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Apache NiFi and Apache NiFi Registry on Kubernetes

Including external OpenAPI models in your own OpenAPI definition

OOPs Concept in Python

Bedrock Extermobinators Add-On

My Experience with IEDC SUMMIT 2k19

API Authentication using Istio Ingress Gateway, OAuth2-Proxy and Keycloak

Experiments with h3 clients + Envoy

LeetCode 430. Flatten a Multilevel Doubly Linked List

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashwin.B

Ashwin.B

webdeveloper and programmer

More from Medium

Convert XML to HTML with Workato

How to set up a Project in Django

Uploading chunk files in Django class based view using Cloudinary

Django Rest Framework — How to Edit Reset Password Link in Dj-Rest-Auth with Dj-AllAuth installed