0

I created a website with django using asgi protocol.
and I would like to view this website via my phone.

After opening a local server on my pc to share the site locally

enter image description here

I searched for my local ip and used it with the port of the server

enter image description here

I also created a new inbound rule in the windows fire wall advanced security which

should let me access any site with any protocol when it is on my network.

enter image description here

After all of that I tried connecting to the site from my phone using this url:

http://10.0.0.6:8000/home/

(I also tried it without home, home is just the landing page for my site)

and the site can't be reached... Is there anything that I am doing wrong lol?

---------_----

2 Answers2

0

Your server is running on a localhost callback not 10.0.0.6:8000.

... development server at 127.0.0.1:8000

That means it can only be accessed on your own computer.

10.0.0.6:8000 is a public IP Address btw.

To fix it you must find your own IP Address in the local network

Linux

sudo ifconfig <network access example: wlo1/ether>

and then the inet entry

Windows

ipconfig

and then the ipv4 address that starts with 192. I can't help you too much here

Fix

Now use the local IP Address you got in your Django config

CodeCraft
  • 11
  • 4
0

If you are just testing and using the runserver command, you probably want to run with

python manage.py runserver 0.0.0.0:8000 to allow others on your network to connect. If you turn debug mode off, you'll have to deal with the allowed_hosts setting by adding your server's ip address.

There is a paragraph about this in the documentation at https://docs.djangoproject.com/en/dev/ref/django-admin/#runserver

AMG
  • 1,606
  • 1
  • 14
  • 25