From e54c717adaa6407424d5336c4cfc9a3a7a58228e Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 18 Dec 2020 15:21:07 +0000 Subject: [PATCH] refactor: allow custom repo to extend constance --- breccia_mapper/settings.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/breccia_mapper/settings.py b/breccia_mapper/settings.py index d32a0b2..395c659 100644 --- a/breccia_mapper/settings.py +++ b/breccia_mapper/settings.py @@ -379,17 +379,28 @@ else: default=(EMAIL_PORT == 465), cast=bool) + +# Upstream API keys + +GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY', default=None) + + # Import customisation app settings if present try: from custom.settings import ( CUSTOMISATION_NAME, TEMPLATE_NAME_INDEX, - TEMPLATE_WELCOME_EMAIL_NAME - ) - logger.info("Loaded customisation app: %s", CUSTOMISATION_NAME) + TEMPLATE_WELCOME_EMAIL_NAME, + CONSTANCE_CONFIG as constance_config_custom, + 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') + logger.info("Loaded customisation app: %s", CUSTOMISATION_NAME) except ImportError as exc: logger.info("No customisation app loaded: %s", exc) @@ -398,7 +409,3 @@ except ImportError as exc: CUSTOMISATION_NAME = None TEMPLATE_NAME_INDEX = 'index.html' TEMPLATE_WELCOME_EMAIL_NAME = 'welcome-email' - -# Upstream API keys - -GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY', default=None)