From: Radek Czajka Date: Wed, 2 Oct 2024 08:41:07 +0000 (+0200) Subject: More archeology. X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/refs/heads/main?ds=inline More archeology. --- diff --git a/docker-compose.yml b/docker-compose.yml index 249139d..456437d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,4 +7,4 @@ services: target: dev volumes: - ./src:/app/src - - ./media:/app/media + - ./var:/app/var diff --git a/src/edumed/settings/__init__.py b/src/edumed/settings/__init__.py index 4a75df0..867381a 100644 --- a/src/edumed/settings/__init__.py +++ b/src/edumed/settings/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from .paths import * from .basic import * from .apps import * from .locale import * @@ -18,4 +17,4 @@ from .custom import * try: from edumed.localsettings import * except ImportError: - pass \ No newline at end of file + pass 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' diff --git a/src/edumed/settings/contrib.py b/src/edumed/settings/contrib.py index d7ea957..076a4b3 100644 --- a/src/edumed/settings/contrib.py +++ b/src/edumed/settings/contrib.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- -CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_SERVER_URL = 'https://logowanie.nowoczesnapolska.org.pl/cas/' CAS_VERSION = '3' +HONEYPOT_FIELD_NAME='miut' + SPONSORS_THUMB_WIDTH = 100 SPONSORS_THUMB_HEIGHT = 56 diff --git a/src/edumed/settings/locale.py b/src/edumed/settings/locale.py index cfe4cc1..f061ca2 100644 --- a/src/edumed/settings/locale.py +++ b/src/edumed/settings/locale.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -import os.path - -from .paths import PROJECT_DIR LANGUAGES = ( ('pl', u'polski'), @@ -36,5 +33,5 @@ CONTRIB_LOCALE_APPS = ( 'pybb', ) LOCALE_PATHS = ( - os.path.join(PROJECT_DIR, 'edumed/locale-contrib'), + '/app/src/edumed/locale-contrib', ) diff --git a/src/edumed/settings/paths.py b/src/edumed/settings/paths.py deleted file mode 100644 index 55d7b9e..0000000 --- a/src/edumed/settings/paths.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -import os.path - -PROJECT_DIR = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) diff --git a/src/edumed/settings/static.py b/src/edumed/settings/static.py index a2f2c05..ba6e390 100644 --- a/src/edumed/settings/static.py +++ b/src/edumed/settings/static.py @@ -1,11 +1,8 @@ # -*- coding: utf-8 -*- -import os.path -from .paths import PROJECT_DIR - -MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media/') +MEDIA_ROOT = '/app/var/media/' MEDIA_URL = '/media/' -STATIC_ROOT = os.path.join(PROJECT_DIR, 'static/') +STATIC_ROOT = '/app/var/static/' STATIC_URL = '/static/' STATICFILES_FINDERS = (