From 1300132d6914d7c9c618158c55954c262d97e2b2 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 21 May 2022 18:45:53 +0200 Subject: [PATCH] Add environment config --- nummi/nummi/settings.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nummi/nummi/settings.py b/nummi/nummi/settings.py index 06495c5..e5ecaab 100644 --- a/nummi/nummi/settings.py +++ b/nummi/nummi/settings.py @@ -11,23 +11,24 @@ https://docs.djangoproject.com/en/4.0/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 -MEDIA_ROOT = Path("/var/lib/nummi") +MEDIA_ROOT = Path(os.environ.get("NUMMI_MEDIA_ROOT", "/var/lib/nummi")) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "h/0OOuNSBRJy9Suo172Y5sJYGgmDqanh" +SECRET_KEY = os.environ.get("NUMMI_SECRET", "dev_sDo6gl1Yf8GIE7XEA2B4xF841eMOpfG1") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = os.environ.get("NUMMI_DEBUG", None) == "True" -ALLOWED_HOSTS = ["nummi.edgarpierre.fr"] -CSRF_TRUSTED_ORIGINS = ["https://nummi.edgarpierre.fr"] +ALLOWED_HOSTS = [os.environ.get("NUMMI_HOST", "localhost")] +CSRF_TRUSTED_ORIGINS = [f"https://{os.environ.get('NUMMI_HOST', 'localhost')}"] # Application definition