From 95f56666080e0a302425c50f9c9309be22fcd374 Mon Sep 17 00:00:00 2001 From: Markus Wanner Date: Sun, 24 Nov 2024 18:40:58 +0100 Subject: [PATCH] Allow loading settings from outside of the postgresqleu tree To ease building docker images and prevent having to maintain an in-tree file for local settings, allow a pgeu_system_settings module anywhere in the PYTHONPATH for configuration. In addition, also allow overrides to be applied after loading the skin. --- postgresqleu/settings.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/postgresqleu/settings.py b/postgresqleu/settings.py index 0b7996ec..e92f94b6 100644 --- a/postgresqleu/settings.py +++ b/postgresqleu/settings.py @@ -307,7 +307,13 @@ try: from .local_settings import * except ImportError as e: - pass + # If there's no local_settings.py within the postgresqleu tree, check + # for a globally available pgeu_system_settings module in any configured + # PYTHONPATH. + try: + from pgeu_system_settings import * + except ImportError as e: + pass PRELOAD_URLS = [] if 'SYSTEM_SKIN_DIRECTORY' in globals(): @@ -334,6 +340,12 @@ else: HAS_SKIN = False +# Try to load overrides from PYTHONPATH. This allows overriding skin +# settings for testing purposes. +try: + from pgeu_system_override_settings import * +except ImportError as e: + pass if not SECRET_KEY: raise Exception("SECRET_KEY must be configured!")