how to access my 127.0.0.1:8000 from android tablet how to access my 127.0.0.1:8000 from android tablet python python

how to access my 127.0.0.1:8000 from android tablet


So, there are a couple of issues it seems. The question most of the answers are addressing is "how do you connect to another server in your local network?" (or variants). There are two answers, you can use the computer's IP directly, or you can use the computer's name (you may need to append .local). For example, my computer is xavier.local.

The second issue is that you seem to be addressing is that runserver is not accessible via other computers on the network (this is your actual question). The reason is that by default Django's runserver will only acknowledge requests from the machine which is calling them. This means that the default settings would make it so that you would only be able to access the server from Windows (and they did this on purpose for security reasons). In order for it to listen to other requests you have two options:

runserver 192.168.1.101:8000 # Only handle requests which are made to the IP address 192.168.1.101

Or (and this is easier when dealing with more than one environment):

runserver 0.0.0.0:8000 # handle all requests

So, if your IP address is 192.168.1.101:

runserver # only requests made on the machine will be handledrunserver 127.0.0.1 # only requests made on the machine will be handledrunserver 192.168.1.101 # handles all requests (unless IP changes)runserver 192.168.1.100 # does not handle any requests (wrong IP)runserver 0.0.0.0 # handles all requests (even if the IP changes)

I do think it important to note that 0.0.0.0 is realistically not a security question when dealing with a local, development machine. It only becomes a significant problem when working on a large app with a machine which can be addressed from the outside world. Unless you have port forwarding (I do), or something wonky like that, you should not be too concerned.


Though this thread was active quite a long time ago. This is what worked for me on windows 10. Posting it in details. Might be helpful for the newbies like me.

  1. Add ALLOWED_HOSTS = ['*'] in django settings.py file

  2. run django server with python manage.py 0.0.0.0:YOUR_PORT. I used 9595 as my port.

  3. Make firewall to allow access on that port:

    • Navigate to control panel -> system and Security -> Windows Defender Firewall

    • Open Advanced Settings, select Inbound Rules then right click on it and then select New Rule

    • Select Port, hit next, input the port you used (in my case 9595), hit next, select allow the connections

    • hit next again then give it a name and hit next for the last time.

  4. Now find the ip address of your PC.

    • Open Command Promt as adminstrator and run ipconfig command.
    • You may find more than one ip addresses. As I'm connected through wifi I took the one under Wireless LAN adapter WiFi. In my case it was 192.168.0.100
    • Note that this ip may change when you reconnect to the network. So you need to check it again then.
  5. Now from another device (pc, mobile, tablet etc.) connected to the same network go to ip_address:YOUR_PORT (in my case 192.168.0.100:9595)

    Hopefully you'll be good to go !


You can find out what the ip address of your PC is with the ipconfig command in a Windows command prompt. Since you mentioned them being connected over WiFi look for the IP address of the wireless adapter.

Since the tablet is also in this same WiFi network, you can just type that address into your tablet's browser, with the :8000 appended to it and it should pull up the page.