Open In App

How To Access Pc Django Server In Android

Last Updated : 22 Sep, 2022
Like Article

Django server is mostly run on computers but when you want to make your Django project responsive and do various testing. Then using mobile can be proved as an advantage. Here we will try to learn how we can deploy our website on our phones.

Stepwise Implementation

Step 1:

we have to first enable Python to communicate through a firewall. For that, you can search in the windows search bar for “allow an app through windows firewall“.


Step 2:

After that, you will see a list of applications that have two options to be clicked: 

  • Private, and
  • Public.

Scroll down and search for Python and python.exe and check them true for both public and private, This will allow your Django project to be accessed over the firewall, and the devices connected to the same wifi can access the things over the firewall.


Step 3:

Start a mobile hotspot and connect your pc with the same wifi as your phone.

Step 4:

After that connecting. Open your command prompt, and write ipconfig in it. You will see your IP details and also your ipv4 address. This way your phone can access your computer’s private network. 


Step 5:

After getting your IP address, go to the Django Project in, and add the IP address to your ALLOWED_HOSTS. This way your phone will not give DISALLOWED_HOST_ERROR, an Invalid HTTP_HOST header. 


Step 6:

After adding your ipv4 address to the allowed hosts, In the terminal write the command to start the server but with the extra argument of the host and the port.

Note: Port can be selected as you want.


python runserver


This runs your server with the host, this host server can mean anything from accepting all IP addresses or blocking all the IP addresses to the default route. This tells all the IP addresses will be accepted to the default route.

Like is a localhost server for the pc, allowing the device to send messages to itself. Same as is an unspecified address that routes you to the default route or unknown target. It depends on the client and server on how it is seen.

Step 7:

Open your mobile phone and open your browser. Now type the IPv4 address of your pc with the port. You will see your site live.

# write this in your phone by
# replacing your ip with
# and then your webpage will be
# deployed in your phone.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads