Whitelist all hosts when debugging

main
Tanner Collin 3 years ago
parent c790f39741
commit 0e1c5d10fb
  1. 16
      server/server/settings.py

@ -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

Loading…
Cancel
Save