X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/d555d988764995ea1f9f5ece46f453a66f09b334..HEAD:/src/edumed/settings/basic.py?ds=inline diff --git a/src/edumed/settings/basic.py b/src/edumed/settings/basic.py index 3e553b3..5a87daf 100644 --- a/src/edumed/settings/basic.py +++ b/src/edumed/settings/basic.py @@ -1,21 +1,66 @@ # -*- coding: utf-8 -*- -import os.path +import os -from .paths import PROJECT_DIR -DEBUG = False -TEMPLATE_DEBUG = DEBUG +ADMINS = [ + tuple(adm.split(':')) + for adm in + os.environ.get('ADMINS', '').split('\n') + if adm +] + +MANAGERS = [ + tuple(adm.split(':')) + for adm in + os.environ.get('MANAGERS', os.environ.get('ADMINS', '')).split('\n') + if adm +] + -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': os.path.join(PROJECT_DIR, 'dev.db'), # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. +if 'DB_NAME' in os.environ: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': os.environ['DB_NAME'], + 'USER': os.environ.get('DB_USER', ''), + 'PASSWORD': os.environ.get('DB_PASSWORD', ''), + 'HOST': os.environ.get('DB_HOST', ''), + 'PORT': os.environ.get('DB_PORT', ''), + } } -} +else: + DEBUG = True + + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/app/var/dev.db', + } + } + + +DEBUG = os.environ.get('DEBUG', str(DEBUG)).lower() == 'true' + +ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split() + +SERVER_EMAIL = os.environ.get('SERVER_EMAIL', 'no-reply@edukacjamedialna.edu.pl') +EMAIL_HOST = os.environ.get('EMAIL_HOST', 'localhost') +DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'no-reply@edukacjamedialna.edu.pl') +EMAIL_SUBJECT_PREFIX = os.environ.get('EMAIL_SUBJECT_PREFIX', '[EdukacjaMedialna.edu.pl] ') + +PIWIK_URL = os.environ.get('PIWIK_URL', '') +PIWIK_SITE_ID = int(os.environ.get('PIWIK_SITE_ID', '0')) +SECRET_KEY = os.environ.get('SECRET_KEY', '') + +MAILCHIMP_API_KEY = os.environ.get('MAILCHIMP_API_KEY', '') +MAILCHIMP_LIST_ID = os.environ.get('MAILCHIMP_LIST_ID', '') +MAILCHIMP_GROUP_ID = os.environ.get('MAILCHIMP_GROUP_ID', '') + + +FNPDJANGO_REALIP = True +FNPDJANGO_XACCEL = False + +TEMPLATE_DEBUG = DEBUG SITE_ID = 1 @@ -41,3 +86,8 @@ TEMPLATE_DIRS = ( # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) + +if DEBUG: + EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + ALLOWED_HOSTS = ALLOWED_HOSTS or ['*'] + SECRET_KEY = SECRET_KEY or 'dev-secret-key'