From 2f71995f3966b13e1afe67a89549464badbaa8f7 Mon Sep 17 00:00:00 2001 From: ronnyabraham Date: Sun, 8 May 2022 16:43:39 +0300 Subject: [PATCH] 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 --- modules/initialize.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/initialize.py b/modules/initialize.py index 77effcd..a4579df 100644 --- a/modules/initialize.py +++ b/modules/initialize.py @@ -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')