Whitelist all hosts when debugging

This commit is contained in:
Tanner Collin 2021-04-15 00:01:18 +00:00
parent c790f39741
commit 0e1c5d10fb

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -23,9 +24,20 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'ayr0nbsni^%h!xbeplx_v#b^cuj^adjg2*z7t@+ht7c=7*1u$e'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG_ENV = os.environ.get('DEBUG', False)
DEBUG = DEBUG_ENV or False
ALLOWED_HOSTS = ['server']
PRODUCTION_HOST = 'example.com'
# production hosts
ALLOWED_HOSTS = [
'api.' + PRODUCTION_HOST,
]
if DEBUG:
ALLOWED_HOSTS += [
'*',
]
# Application definition