diff --git a/mandelstudio/settings/base.py b/mandelstudio/settings/base.py index 9447090..ea4ca2d 100644 --- a/mandelstudio/settings/base.py +++ b/mandelstudio/settings/base.py @@ -21,6 +21,7 @@ BASE_DIR = str(BASE_PATH) setup_search_paths("/etc/ocyan/", str(_project_app_path)) from ocyan.main.settings import * # pylint:disable=W0401,W0614 +from ocyan.core.fender import config as ocyan_config INSTALLED_APPS = [ "mandelblog_content_guard.apps.MandelblogContentGuardConfig", @@ -60,6 +61,21 @@ _ensure_required_app( "ocyan.plugin.coyote", ) +def _ensure_installed_app(app_label: str, *, before: str | None = None) -> None: + """Ensure an app is present in INSTALLED_APPS with optional ordering.""" + if app_label in INSTALLED_APPS: + INSTALLED_APPS.remove(app_label) + if before and before in INSTALLED_APPS: + INSTALLED_APPS.insert(INSTALLED_APPS.index(before), app_label) + else: + INSTALLED_APPS.append(app_label) + + +# Prefer Carbasa's webshop templates whenever this project runs as a webshop. +# Ensures the full Carbasa webshop header (search, user bar, cart, megamenu). +if ocyan_config.is_webshop and importlib.util.find_spec("ocyan.plugin.carbasa.webshop"): + _ensure_installed_app("ocyan.plugin.carbasa.webshop", before="ocyan.plugin.carbasa") + # Keep Carbasa/Coyote defaults stable even when plugin settings are not # injected early enough during startup on this deployment. OXYAN_HEADER_OPTIONS = globals().get(