Hangon Hangon - 1 month ago 13
Python Question

How to Django remote access to server using Windows

I'm starting the tango-with-django tutorial.
And I'm trying to access the created website using other computer. Both computers are using Windows OS. And this is not working.

$ python manage.py runserver <your_machines_ip_address>:5555


I'm using the IPv4 Adress that I get when I type:

$ ipconfig


What am I doing wrong or what is missing?

Answer

Download ngrok from here: https://ngrok.com/ (this will allow you to serve your web app to anyone on the Internet)

Start your Django project normally or provide any port number.

python manage.py runserver

If you are running windows, open a command prompt and browse to the location where the ngrok binary is located. If you are running GNU/Linux / OSX, just open a terminal.

Then run the following command.

ngrok 8000

Replace 8000 by whichever port the Django project is running on.

ngrok will give you a public hostname like http://abc.ngrok.com

Anyone you give this address to will be able to view / interact with your Django application anywhere on the Internet.


Update: Newer versions of ngrok need to be run like this: ngrok http 8000