use environ for environment variables

This commit is contained in:
2020-09-18 04:30:35 +00:00
parent 4d5a03c01c
commit 49f64b9108
2 changed files with 13 additions and 6 deletions

View File

@@ -11,6 +11,11 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
import environ
env = environ.Env(
# set casting, default value
DEBUG=(bool, True)
)
# Prints and logs are written to console
# TODO: Change before release
@@ -37,13 +42,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DEBUG')
if DEBUG:
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'r37-i7l)vrduzz2-gira+z#u!p!di9#f+%s*5-bb($hg)55@ns'
else:
SECRET_KEY = env('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["127.0.0.1", "localhost"]
DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024
# Application definition

View File

@@ -8,4 +8,4 @@ docutils==0.16
easy-thumbnails==2.7.0
etherpad-lite==0.5
django-filter
ldap3
ldap3django-environ