prevent mailman-web dns lookup from throwing (#681)

This commit is contained in:
mmurphy
2024-01-22 14:59:28 +11:00
committed by GitHub
parent 06e0ed0f00
commit 1fc0716564

View File

@@ -29,7 +29,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
import os
import dj_database_url
import sys
from socket import gethostbyname
from socket import gethostbyname, gaierror
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -50,9 +50,14 @@ SITE_ID = 1
ALLOWED_HOSTS = [
"localhost", # Archiving API from Mailman, keep it.
"mailman-web",
gethostbyname("mailman-web"),
os.environ.get('SERVE_FROM_DOMAIN'),
]
try:
ALLOWED_HOSTS.append(gethostbyname("mailman-web")) # only add if this resolves
except gaierror:
pass
ALLOWED_HOSTS.extend(os.getenv("DJANGO_ALLOWED_HOSTS", "").split(","))
# Mailman API credentials