Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django run localhost from another computer connected to another network

I am running my django project in localhost and it works fine.. For test purpose I want to run my localhost from another computer connected in the same network.

I have done python manage.py runserver 'my ip address'

That works fine too.. Is there any way that I can access my localhost from another computer connected to another network?

Like I am connected to A network and running my localhost and my friend is connected to B network. Suppose he wants to access my localhost and see my project running then is it possible to access localhost of a computer from another computer connected to another project?

like image 261
varad Avatar asked Jan 15 '15 04:01

varad


1 Answers

You can. Just run the django runserver in

python manage.py runserver 0.0.0.0:8000

Now you can access your app using youripaddress:8000

From Django ...

Note that the default IP address, 127.0.0.1, is not accessible from other machines on your network. To make your development server viewable to other machines on the network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0 or :: (with IPv6 enabled).

You can provide an IPv6 address surrounded by brackets (e.g. [200a::1]:8000). This will automatically enable IPv6 support.

Updated:

In order to match the answer to Title of the question. You need configure your router to forward port 80 to yourapp address

like image 114
Raja Simon Avatar answered Oct 13 '22 03:10

Raja Simon