diff --git a/config/settings/base.py b/config/settings/base.py index 98bc076a6f657f8112bc963a8fcb10e01c2b3226..00e5a764355fe3bd1ec3633be5284572b651f375 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -67,6 +67,10 @@ USE_TZ = True # stopping requests submitted with a fake HTTP Host header. ALLOWED_HOSTS = ['localhost', '127.0.0.1'] +# Internal hostname and IP address +INTERNAL_HOSTNAME = socket.gethostname() +INTERNAL_IP_ADDRESS = socket.gethostbyname(INTERNAL_HOSTNAME) + # Sessions settings ----------------------------------------------------------- SESSION_COOKIE_AGE = 3600*23 SESSION_COOKIE_SECURE = True diff --git a/config/settings/container/dev.py b/config/settings/container/dev.py index f7c21b8314bcf0b15852ab5670006044297bc659..cf1447dfef7f1966843438b64fabd1a2b440848f 100644 --- a/config/settings/container/dev.py +++ b/config/settings/container/dev.py @@ -43,10 +43,9 @@ if 'silk' in INSTALLED_APPS: # some headers which we want to keep hidden. So to be safe, we only allow # it to be used through this server. You need to configure a SOCKS proxy # on your local machine to use DJDT (see admin docs). -# FIXME -#INTERNAL_IPS = [ -# socket.gethostbyname(SERVER_HOSTNAME), -#] +INTERNAL_IPS = [ + INTERNAL_IP_ADDRESS, +] # Adjust ADMINS for dev instances ADMINS = [ diff --git a/config/settings/vm/base.py b/config/settings/vm/base.py index 31078c7bf0375934ac71b92c2ee89b6c1936fb81..febed8965d227df8f1ffe0b399ab8f0ee4b532ab 100644 --- a/config/settings/vm/base.py +++ b/config/settings/vm/base.py @@ -21,7 +21,7 @@ DATABASES = { # Set up allowed hosts SERVER_FQDN = socket.getfqdn() -SERVER_HOSTNAME = socket.gethostname() +SERVER_HOSTNAME = INTERNAL_HOSTNAME ALLOWED_HOSTS += [SERVER_FQDN, '{hostname}.ligo.org'.format( hostname=SERVER_HOSTNAME)] diff --git a/config/settings/vm/dev.py b/config/settings/vm/dev.py index 1724bd7cf7da4ab3eabf948b0ba6d516e77af344..118235c53e40999cec699bc559d5aa6862e0e5aa 100644 --- a/config/settings/vm/dev.py +++ b/config/settings/vm/dev.py @@ -46,7 +46,7 @@ if 'silk' in INSTALLED_APPS: # it to be used through this server. You need to configure a SOCKS proxy # on your local machine to use DJDT (see admin docs). INTERNAL_IPS = [ - socket.gethostbyname(SERVER_HOSTNAME), + INTERNAL_IP_ADDRESS, ] # Adjust ADMINS for dev instances