Use local hosts only when debug is enabled

This commit is contained in:
Gabriel Augendre 2020-08-21 13:32:09 +02:00
parent 76fcefccf1
commit 02f64aef12

View file

@ -45,13 +45,13 @@ EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
DEBUG = os.getenv("DEBUG", "true").lower() == "true" DEBUG = os.getenv("DEBUG", "true").lower() == "true"
TESTING = os.getenv("TESTING", "false").lower() == "true" TESTING = os.getenv("TESTING", "false").lower() == "true"
ALLOWED_HOSTS = [ ALLOWED_HOSTS = []
"localhost", if DEBUG:
"127.0.0.1", ALLOWED_HOSTS.extend(["localhost", "127.0.0.1"])
]
HOST = os.getenv("HOST") HOSTS = os.getenv("HOSTS")
if HOST: if HOSTS:
ALLOWED_HOSTS.append(HOST) ALLOWED_HOSTS.extend(HOSTS.split(";"))
# Application definition # Application definition