[英]What does [::1] mean in ALLOWED_HOSTS in Django?
I was going through the documentation for Django's ALLOWED_HOSTS
here 我在这里浏览 Django
ALLOWED_HOSTS
的文档
I came across a string ['localhost', '127.0.0.1', '[::1]']
in the ALLOWED_HOSTS
. 我在
ALLOWED_HOSTS
遇到了字符串['localhost', '127.0.0.1', '[::1]']
。
Everything looks fine except the '[::1]'
part. 除了
'[::1]'
部分外,其他所有内容看起来都不错。
I can't find a realtime scenario where '[::1]'
is used. 我找不到使用
'[::1]'
的实时场景。
Can someone please explain in which use case we will use this [::1]
有人可以解释在哪种用例中我们将使用此
[::1]
[:: 1]是ipv6中的回送地址,等效于ipv4中的127.0.0.1。
我知道:: 1通常用于IPv6作为本地主机
That's most important part of settings - change ALLOWED HOSTS
when you install your project to server. 这是设置最重要的部分-改变
ALLOWED HOSTS
,当您安装项目服务器。 The settings there must be the same as in server configuration (eg nginx/gunicorn), but different for debug stage on local machine. 那里的设置必须与服务器配置中的设置相同(例如,nginx / gunicorn),但对于本地计算机上的调试阶段,则必须不同。
Advice: put all crucial settings like ALLOWED HOSTS
in another one file in terms of security. 建议:就安全性而言,将所有重要设置(如“
ALLOWED HOSTS
放在另一个文件中。
But while you're debugging-developing on local machine - you don't really need to change ALLOWED HOSTS
. 但是,当您在本地计算机上进行调试开发时,实际上并不需要更改
ALLOWED HOSTS
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.