Testing A Mobile Django Site on a Phone on a LAN

Getting a site to layout well on mobile can be tricky. Although there are some decent mobile emulators, I still frequently run into important differences when I view it on a real phone.

Web pages for the desktop are easy to test using the Django development server. This note describes how to browse the development server from a mobile device that is on the same LAN as the server.

    1. Connect to the LAN with your phone
    2. Get the local IP address of the computer that runs the development server. On Linux the command is ifconfig (that’s not a typo. It’s not ipconfig). My computer’s IP address is 192.186.1.64
    3. Start the development server as follows: python manage.py runserver 0.0.0.0:8800 
    4. Start a browser on your phone
    5. Goto: http://<the server IP address>:8800  In my case that would be http://192.168.1.64:8800

You should see your website on your phone now.

Can’t Connect?

Is wi-fi on on your phone?

 

 

 

Advertisements