fix allowed host env

This commit is contained in:
2023-10-29 14:53:48 +01:00
parent f860a5bf1d
commit ffbf548c7a
2 changed files with 5 additions and 4 deletions

View File

@@ -16,3 +16,4 @@ POSTGRES_DB=
DRF_SECRET_KEY=
DRF_DEBUG=
ALLOWED_HOSTS=

View File

@@ -11,7 +11,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
import os
import os, socket
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -26,8 +26,8 @@ SECRET_KEY = os.getenv("DRF_SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv("DRF_DEBUG", False) == "True"
ALLOWED_HOSTS = []
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(",")
ALLOWED_HOSTS = [] if not any(ALLOWED_HOSTS) else ALLOWED_HOSTS
# Application definition