tags:

views:

271

answers:

3

Hi All:

I've got a server and we run a django powered site. Since we want to test the site, so we use django's build-in development server(i.e runserver). But I'm curious about the ip of the command:

python manage.py runserver 0.0.0.0:80

Then we can visit the test site using server's ip remotely. But when I try:

python manage.py runserver 127.0.0.1:80

No one can visit the site with the sever's ip from another pc.

So why so? what does 0.0.0.0 this ip mean?(google says 0.0.0.0 is the default route) Why 127.0.0.1:80 this approach can't be accessed?

Regards

+2  A: 

127.0.0.1 is the local (loopback) ip, not the ip of that computer on the network. To access a server across the network, you'll need to know its' network ip

adam
thanks adam. but is 0.0.0.0:80 a must to provide the access for other clients?
Tower Joo
+2  A: 

127.0.0.1 is the loopback interface, also known as localhost; this is an address that is only accessible from the same computer, as nothing actually goes over the network. 0.0.0.0 means "listen on all interfaces", and thus will listen for connections on all IP addresses that machine has (likely only one).

Brian Campbell
+10  A: 

0.0.0.0:80 is a shortcut meaning "bind to all IP addresses this computer supports". 127.0.0.1:80 makes it bind only to the "lo" or "loopback" interface. If you have just one NIC with just one IP address, you could bind to it explicitly with, say, "192.168.1.1:80" (if 192.168.1.1 was your IP address), or you could list all the IPs your computer responds to, but 0.0.0.0:80 is a shortcut for that.

Paul Tomblin
great explanation, Paul!
Tower Joo