Django ALLOWED_HOSTS IPs range

前端 未结 5 1709
醉梦人生
醉梦人生 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:43

    Here is a quick and dirty solution.

    ALLOWED_HOSTS += ['172.17.{}.{}'.format(i,j) for i in range(256) for j in range(256)]
    

提交回复
热议问题