fix allowed host env
This commit is contained in:
@@ -15,4 +15,5 @@ POSTGRES_USER=
|
|||||||
POSTGRES_DB=
|
POSTGRES_DB=
|
||||||
|
|
||||||
DRF_SECRET_KEY=
|
DRF_SECRET_KEY=
|
||||||
DRF_DEBUG=
|
DRF_DEBUG=
|
||||||
|
ALLOWED_HOSTS=
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
import os, socket
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
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!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = os.getenv("DRF_DEBUG", False) == "True"
|
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
|
# Application definition
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user