Serve Django Project on WiFi LAN

I used

python manage runserver 0.0.0.0:8000

to start the server so that I can access the project from other computers on my Wi-Fi wireless network, but when I browse the ipaddress: 8000 internet on another computer, the project does not load. Am I missing settings?

+4
source share
6 answers

Assuming all cars can see each other ...

Get the IP address of the computer on which the server is running. For example, run ifconfig on the console.

 ifconfig eth0 Link encap:Ethernet HWaddr 10:1e:72:b8:2a:4b inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 ... 

check if the firewall is working. for instance

 sudo ufw status 

if active, you need to open port 8000, so run the console again

 sudo ufw allow 8000/tcp 

then run runerver (or runerver_plus when using django-extensions)

 python manage.py runserver_plus 192.168.1.2:8000 

open a browser on another computer

 http://192.168.1.2:8000/admin 
+7
source

What do you mean by internet-ipaddress ? It looks like you are using the external IP address of your router. You must use the IP address of the specific machine you are running on, which will be the internal address, for example 192.168.0.2 .

+6
source

You must bind it to the local IP address. for instance

 python manage.py runserver 192.168.1.100:8000 
+5
source

You should check out solutions like Pagekite or Show Off , as they are usually trivially easy to set up and offer more flexibility (and mobility) and provide a stable domain name on your localhost server.

+2
source

Note: 192.168.2.5 is my ip. So give your own

Open the settings.py file and add it to ALLOWED_HOSTS

 ALLOWED_HOSTS = ['192.168.2.5'] 

Then run the command

 python manage.py runserver 192.168.2.5:8000 

Allow access to a firewall alert.

Now access your host from systems on the same network.

+1
source

add 192.168.0.8 (or whatever your router’s IP address) as a string to the ALLOWED_HOSTS list in the settings, and then start the server using python manage.py runningerver 192.168.0.8:8000

0
source

All Articles