refactor: allow custom repo to extend constance

This commit is contained in:
James Graham
2020-12-18 15:21:07 +00:00
parent efecfa8e43
commit e54c717ada

View File

@@ -379,17 +379,28 @@ else:
default=(EMAIL_PORT == 465), default=(EMAIL_PORT == 465),
cast=bool) cast=bool)
# Upstream API keys
GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY', default=None)
# Import customisation app settings if present # Import customisation app settings if present
try: try:
from custom.settings import ( from custom.settings import (
CUSTOMISATION_NAME, CUSTOMISATION_NAME,
TEMPLATE_NAME_INDEX, TEMPLATE_NAME_INDEX,
TEMPLATE_WELCOME_EMAIL_NAME TEMPLATE_WELCOME_EMAIL_NAME,
) CONSTANCE_CONFIG as constance_config_custom,
logger.info("Loaded customisation app: %s", CUSTOMISATION_NAME) CONSTANCE_CONFIG_FIELDSETS as constance_config_fieldsets_custom
) # yapf: disable
CONSTANCE_CONFIG.update(constance_config_custom)
CONSTANCE_CONFIG_FIELDSETS.update(constance_config_fieldsets_custom)
INSTALLED_APPS.append('custom') INSTALLED_APPS.append('custom')
logger.info("Loaded customisation app: %s", CUSTOMISATION_NAME)
except ImportError as exc: except ImportError as exc:
logger.info("No customisation app loaded: %s", exc) logger.info("No customisation app loaded: %s", exc)
@@ -398,7 +409,3 @@ except ImportError as exc:
CUSTOMISATION_NAME = None CUSTOMISATION_NAME = None
TEMPLATE_NAME_INDEX = 'index.html' TEMPLATE_NAME_INDEX = 'index.html'
TEMPLATE_WELCOME_EMAIL_NAME = 'welcome-email' TEMPLATE_WELCOME_EMAIL_NAME = 'welcome-email'
# Upstream API keys
GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY', default=None)