changed django.allowed_hosts to type set from type list, bc I found that names were being duplicated in the allowedhosts, so I'm side stepping that by using set

This commit is contained in:
ronnyabraham 2022-05-08 16:43:39 +03:00
parent 9106127a16
commit 2f71995f39

View file

@ -266,14 +266,20 @@ def get_config(branchname):
# allowed_hosts are the ip addresses and hostnames
# that this instance is allowed to run on
dataobject.project.django.allowedhosts = list()
# use the Set variable type b/c we don't want duplicated
# of any of the ip addresses or host names
#
# this is because I found that sometimes "extendedname" is the same
# as host or as PROJECT_HOST.EXTENSION
dataobject.project.django.allowedhosts = set()
_allowed = getattr(dataobject.project.django, 'allowedhosts')
_allowed.append(dataobject.project.extendedname)
_allowed.append(dataobject.project.host)
_allowed.add(dataobject.project.extendedname)
_allowed.add(dataobject.project.host)
if 'allowed_hosts' in config['django']:
for allowed in config['django']['allowed_hosts']:
_allowed.append(allowed)
_allowed.add(allowed)
dataobject.addbranch('paths')