Django ALLOWED_HOSTS IPs range

前端 未结 5 1707
醉梦人生
醉梦人生 2021-01-31 08:46

Is there a way to set a range of ALLOWED_HOSTS IPs in django?

Something like this:

ALLOWED_HOSTS = [\'172.17.*.*\']
5条回答
  •  遇见更好的自我
    2021-01-31 09:28

    I posted a ticket on Django however I was shown this could be achieved by doing the following

    from socket import gethostname, gethostbyname 
    ALLOWED_HOSTS = [ gethostname(), gethostbyname(gethostname()), ] 
    

    https://code.djangoproject.com/ticket/27485

提交回复
热议问题