That causes the development server to listen on all available
network interfaces. This, unfortunately, is not explained in the
runserver documentation [1] or the admin utility's built-in help.
The only place I've found it documented is in chapter two of The
Django Book [2]. This is not Django-specific, as RFC 3330
("Special-Use IPv4 Addresses") [3] defines addresses in the
0.0.0.0/8 block as referring to "source hosts on `this' network",
but it seems that it would be helpful to note this in the Django
docs for people who are unfamiliar with this convention.
> Generally 127.0.0.0:8000 would be your localhost
That would cause the development server to listen on port 8000 of
whatever interface uses 127.0.0.0. The hostname "localhost" [4]
typically resolves to 127.0.0.1, the address of the loopback
interface [5].
References:
[1]: <http://docs.djangoproject.com/en/1.0/ref/django-admin/#runserver>
[2]: <http://www.djangobook.com/en/2.0/chapter02/#cn112>
[3]: <http://www.rfc-editor.org/rfc/rfc3330.txt>
[4]: <http://en.wikipedia.org/wiki/Localhost>
[5]: <http://en.wikipedia.org/wiki/Loopback>
--
Phil Mocek
Thanks. I plan to open a ticket for an update to the documentation
if one doesn't already exist. I'll add this information.
I missed this mention of 0.0.0.0 because I was searching for
"interface" or "IP address" but the tutorial says -- incorrectly or
colloqially, depending on how you see things -- "So to listen on all
public IPs (useful if you want to show off your work on other
computers), use:". There's no such thing as a "public IP".
--
Phil Mocek
I suspect the intent is "external IP" compared to an internal IP
(localhost/127.0.0.1). By default Django only listens on
localhost ("private" or "internal"). If your machine is
multi-homed (has multiple IP addresses such as a dialup, aircard,
VPN, LAN, wireless, etc), you can specify that Django listens on
a single address such as 192.168.1.99 (which should be bound to a
single interface). If you specify 0.0.0.0 Django will listen on
any interfaces/IP-address. These latter cases would be "public"
or "external".
-tim
I agree.
What makes the tutorial technically incorrect, and what prevents
someone who seeks information about using the 0.0.0.0 IP address
from finding that passage using reasonable search terms, is its
omission of the word "address". The subject at hand is an
address, not a protocol, yet what was written is "public IP" not
"public IP address". This is fine for casual conversation, but --
for reasons including that which was discovered in this discussion
-- not for a technical tutorial whose target audience is software
developers.
--
Phil Mocek
This is good clarification. It would be great if one of you can open a
ticket and supply a patch.
--
George