K
K
Kirill2018-05-08 16:56:40
Django
Kirill, 2018-05-08 16:56:40

I launched a local Django server, but how can I view the page through my phone via wifi?

I launched a local Django server, but how can I view the page through my phone via wifi?
OC Ubuntu 16.04
Django 2.0
Tried to enter on (Phone) 127.0.0.1:8000 but - Can't establish a connection with site.
What can be done?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AlexandrBirukov, 2018-05-08
@AlexandrBirukov

ngrok is a handy thing, it allows you to share localhost + https distributes, you can watch not only in your wifi

V
vreitech, 2018-05-08
@fzfx

type in the address bar http://ip:port, where ip is the IP address of the host Django is running on, port is the port Django is listening on. if it doesn't help, try again, replacing http with https. if it doesn't help, check if Django is really listening on the specified port; whether the specified IP is really the IP of the Django host and that this IP is from the same subnet as the IP address on the wi-fi phone; Is the port blocked by a firewall?

V
Vladimir Kuts, 2020-09-07
@fox_12

Tried to enter on (Phone) 127.0.0.1:8000 but - Can't establish a connection with site.

By itself. This is the localhost address. That is, you tried to enter at the address belonging to the phone itself.
Since you are trying to login at :8000, the fastest way is to run it in development mode
. In this case, run like this:
... runserver 0.0.0.0:8000

so that your server listens on the interface not only on the loopback interface.
Find out the ip address of the server on which you run django on your network - maybe something like 192.168.xxx.yyy - and if your phone and the server are on the same subnet - then the page will be accessible at the address
http://192.168.xxx.yyy:8000if no firewall additionally blocks it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question