Setting up a Django development server that can be accessed by other devices on my network


I want to set up a Django development server that both my computers and smart phones can access whilst on my network via wifi.

I’ve already set up a development server that my computer can access on However, my other devices can’t.

The Django documentation says:

“Note that the default IP address,, is not accessible from other machines on your network. To make your development server viewable to other machines on the network, use its own IP address (e.g. or or :: (with IPv6 enabled).”

I’ve found my “public IP address” and tried to use this by:
python runserver (where this is my public ip address) but i get a “Command error: ‘’ is not a valid port number or address:port pair.”

I then tried the same with :8000 after the IP address, but got an error “Error: That IP address can’t be assigned to”.

Then python runserver The command line reports “Starting development server at …”, but when i try “” on Chrome, i get a “This site can’t be reached error”.

Is it something to do with my windows firewall settings?
Please can you someone help me? Thanks!

Asked By: Mark



You will need your local ip address not public.
You can get the local ip in windows machine by typing the following command in cmd : ipconfig .

On Linux type the following in terminal : ifconfig

The ip address will be of the form[Example]

So in your phone’s browser type :

Answered By: Stack is not a real address, it’s a placeholder that just says that the server is not bound to a specific IP.

If you run on, it will only answer to queries that where addressed to, so localhost only.

Using your private address (192.168.0.x most often), it will only answer to queries to this address (so opening with the should not work, but sometime does depending on the implementation)

So, if you use, it will answer to anything.

tl;dr : use and connect using :

  • from this computer

  • your computer’s private ip address for other computers inside your lan

  • you public IP for computers outside your lan. Note that this will require additional configuration on your router

Answered By: Anthony Rossi

This is very late, but I run onto an additional issue following this post. If you are using a rhel distro based and if firewalld
is enabled it might be blocking the connection. So for testing purposes run:

systemctl stop firewalld
Answered By: user2171775 defaults to the localhost of the system. So connecting with that address from another device, is telling that device to connect to itself. you can use your ipaddress, but in other for django to allow it. Go to your projects file. You should see an option ALLOWED_HOSTS = []. Put in your ipaddress in quotes, e.g ‘’. Save it and when next you want to run the server. add the ipaddress:8000 after issuing the command. This will allow django to host your site on your computers ipaddress, but only devices on the same wifi can access it. The scope of that is beyond the question. You might also need to allow Django to bypass your systems firewall.

Answered By: luko
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.