[Django]-Cannot Connect to Django from outside the Local Server

12👍

From https://docs.djangoproject.com/en/2.0/ref/django-admin/#runserver

Note that the default IP address, 127.0.0.1, 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. 192.168.2.1) or 0.0.0.0 or :: (with IPv6 enabled).

You must run with the command python3.6 manage.py runserver 0.0.0.0:8000

Then figure out the VM’s local IP and navigate to it

http://192.168.0.XXX:8000   <--- Use local IP of VM
👤ryan

2👍

runserver without specifying an IP will only listen to the loopback interface.

You need python3.6 manage.py runserver 123.123.123.123 (assuming the IP of your network interface is “123.123.123.123”).

👤Kal

Leave a comment