[Fixed]-Access Django devserver from another machine same network


Use python manage.py runserver <ip>:<port>

For example,my IP is and I want to run django app on port 80,I have to do

[sudo] python manage.py runserver

My port 80 needed root permissions,maybe because I have other applications accessing it.

You also have to add the IP address to ALLOWED_HOSTS list in settings.py

By doing this all clients in the 192.168.0 network will be able to access the site at



You’re starting Django as needed – it will accept connections from anywhere as soon as the connections get to it.

Check your firewall and make sure it’s allowing 8000 port connections. Something like this should work:

iptables -I INPUT -p tcp -m tcp --dport 8000 -j ACCEPT

Optionally you will need to extend the INTERNAL_IPS variable in the setting to allow remote debugging: https://docs.djangoproject.com/en/dev/ref/settings/#internal-ips .



skarap is correct. If your network is configured correctly and your django application with pytho9n manage.py runserver and you still can’t access your django app from the VM host there is almost certainly a firewall issue. The illustration above is good if you are running iptables.

I deployed CentOS 7 on a virtualbox VM from a Windows 7 host. I didn’t know that this distribution uses firewalld, not iptables to control access.


ps -ae | grep firewall
returns something like
602 ? 00:00:00 firewalld

your system is running firewalld, not iptables. They do not run together.

To correct you VM so you can access your django site from the host use the commands:

firewall-cmd –zone=public –add-port=8000/tcp –permanent
firewall-cmd –reload

Many thanks to pablo v on the http://www.scriptscoop.net site for pointing this out.


You have to add the server IP to the ALLOWED_HOSTS in the settings.py


set firewall rules with
$ sudo ufw enable
$ sudo ufw allow 8000

type ipconfig
copy addr under inet

do python3 manage.py runserver your_inet_addr:8000

Leave a comment