prevent mailman-web dns lookup from throwing (#681)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user