DEV Community

ADEMOLA OGUNMOKUN
ADEMOLA OGUNMOKUN

Posted on • Edited on

How to connect your Django local development server to your mobile phone and test your app on your phone.

Building a web application in Django, the developer will often use the lightweight local development server to run the code and see the changes that have been made.

However it is often useful to see how the web app is doing on a particular mobile phone.

To do that, we need to connect the phone and the computer(local machine) on the same WiFi network. With Phone as the hotspot and the computer as WiFi.

Thereafter, click on your computer WiFi settings and note the IP address used.

For this example I am using 192.168.43.167 as the WiFi IP address.

On the Django project on your computer, click on the settings.py and navigate through to the Allowed Host. Change the empty list to the IP address noted earlier.

#Settings.py

Allowed Host = ["192.168.43.167"]
Enter fullscreen mode Exit fullscreen mode

Start your local development server by running

Python manage.py runserver IP:Port

For example, if the WiFi IP address noted earlier is 192.168.43.167.

Python manage.py runserver 192.168.43.167:8000
Enter fullscreen mode Exit fullscreen mode

On your phone browser input the IP address and the port number into the address bar to see your app.

http://192.168.43.167:8000

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more