How to make a port live in windows using command line?

544 views Asked by At

I am running my django-python server on localhost and it gives following status while running:

System check identified 1 issue (0 silenced). January 04, 2017 - 19:58:23 Django version 1.9, using settings 'goldbrex.settings' Starting development server at http://127.0.0.1:9000/ Quit the server with CTRL-BREAK.

I want my fellow(windows user to hit an API running on localhost at my PC, How to make it possible using command line?

2

There are 2 answers

0
Shang Wang On

You can't let others visit your site if you run your server on 127.0.0.1, which is localhost only. I think you need to start your server like this:

manage.py runserver 0.0.0.0:9000

Then other people could grab your ip address(assume it's 1.2.3.4) and visit it in the browser:

1.2.3.4:9000  

Check wikipedia on what is 0.0.0.0

0
Alex Vyushkov On

First, you should run your django application on 0.0.0.0, so external users can connect to it

 python manage.py runserver 0.0.0.0:9000

Then (assuming port 9000 is open in your firewall), your fellow developers can access your application using your IP address - you can figure it out using ifconfig command if you are on Linux.

For example, if your IP address is 129.1.1.1, they should use 129.1.1.1:9000

There are some gotchas with firewall and internal IP address, but that would be your first step.