diff --git a/server/server/settings.py b/server/server/settings.py index f9e9d00..3cd02b1 100644 --- a/server/server/settings.py +++ b/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