What is meaning of '[::1]'?

33 views
Skip to first unread message

bob gailer

unread,
Nov 20, 2016, 9:46:38 PM11/20/16
to Django users
From
https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-ALLOWED_HOSTS:

"When DEBUG is |True| and |ALLOWED_HOSTS| is empty, the host is
validated against |['localhost', '127.0.0.1', '[::1]']|."

What is meaning of '[::1]'?

James Bennett

unread,
Nov 20, 2016, 9:54:01 PM11/20/16
to django...@googlegroups.com
It's the IPv6 loopback address. So it has the same function as 127.0.0.1, just for IPv6 instead of IPv4.



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/02858789-fa42-f8fe-817f-94360b3ddd7d%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Stephen J. Butler

unread,
Nov 20, 2016, 11:08:05 PM11/20/16
to django...@googlegroups.com
"::1" is the IPv6 loopback address. If you haven't seen IPv6 addresses before, they separate the parts of an address with ":" instead of ".". Using two together ("::") is a shorthand for "fill all these bits with zero" and it can appear only once in an address.

You see the brackets "[]" in URLs because otherwise any URL parser would get confused by what's the address and what's the port. For example, is "http://2607:f8b0:4009:812::200e:8080" telling you to connect to address "2607:f8b0:4009:812::200e" on port "8080", or address "2607:f8b0:4009:812::200e:8080" on the standard port 80? Brackets make this unambiguous: "http://[2607:f8b0:4009:812::200e]:8080/"

Reply all
Reply to author
Forward
0 new messages