To host on a local network, first ensure that your IP address is added to the ALLOWED_HOSTS
of settings.py
.
ALLOWED_HOSTS = ['192.168.1.X']
Note: Your IP address can be locate via running
ipconfig
in the command prompt
Ensure you also execute runserver
on ip address 0.0.0.0:8000
. For example:
python manage.py runserver 0.0.0.0:8000
When connecting with other devices put the IP address and the port number of the host in the URL within the browser. Like so:
192.168.1.X:8000/<app_name>/other_pages
Source : https://stackoverflow.com/questions/68713009/cant-access-django-server-remotely
No comments:
Post a Comment