How to run Django site locally on your mobile and other devices
Let’s break down this blog into steps to understand better that is how to run Django localhost site on your mobile, tablets, and other devices.
Step 1
Make sure your main device in which Django server is running and other devices are connected to the same network. This is the most important step. Otherwise, you will not be able to access the site from other networks.
Step 2
Check your network IP address using the command “ipconfig” in cmd. There you will find the IPv4 Address like the below screenshot.
Step 3
Now, Go to your Django settings.py file and add this IP to Allowed hosts.
Step 4
The final step is to run the Django server on your main device using the below command which includes the IP and port
All done!. Yeah, you read it right, that’s it and now you can check the site on your different devices but the only thing that you need to keep in mind is that all the devices on which you are testing are connected to the same network.
Now hit your network IP followed by a port like “192.168.1.10:8000” into your mobile device browser and you will see the site is working over there.