From fd21901ef5fed2c8db8e87b9f1960e3b2ce00560 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Thu, 19 Dec 2024 10:15:44 -0800 Subject: [PATCH] Fix enabling multiple languages if the `APP_NAME` in the db was "Arches" #11660 (#11687) * Use same guard for "last" project as project-level urls.py #11660 This check sniffs for whether this urls.py is the one being run as a project (not included by any further apps). For core arches, this would only be true if running core arches without a project. This was failing on a Django exception inside i18n_patterns(). This check is the same check that we're using in project-level settings.py * Also avoid checking APP_NAME in generate_frontend_configuration() --- arches/settings_utils.py | 5 ++++- arches/urls.py | 2 +- releases/7.6.4.md | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arches/settings_utils.py b/arches/settings_utils.py index 7fa9efa396c..67476e3898b 100644 --- a/arches/settings_utils.py +++ b/arches/settings_utils.py @@ -164,7 +164,10 @@ def generate_frontend_configuration(): "WEBPACK_DEVELOPMENT_SERVER_PORT": settings.WEBPACK_DEVELOPMENT_SERVER_PORT, } - if settings.APP_NAME == "Arches": + if str(Path(app_root_path).parent) == root_dir_path: + # Running core arches directly without a project, e.g.: + # app_root_path: arches/app + # root_dir_path: arches base_path = root_dir_path else: base_path = app_root_path diff --git a/arches/urls.py b/arches/urls.py index e4ba6cf8c40..6423f379ed9 100644 --- a/arches/urls.py +++ b/arches/urls.py @@ -736,7 +736,7 @@ # This must be included in core to keep webpack happy, but cannot be appended when running a project. # See https://github.com/archesproject/arches/pull/10754 -if settings.APP_NAME == "Arches": +if settings.ROOT_URLCONF == __name__: if settings.SHOW_LANGUAGE_SWITCH is True: urlpatterns = i18n_patterns(*urlpatterns) diff --git a/releases/7.6.4.md b/releases/7.6.4.md index c6dd33db795..db8817e9f58 100644 --- a/releases/7.6.4.md +++ b/releases/7.6.4.md @@ -12,6 +12,7 @@ - Fix regression where Arches is no longer overriding Django admin templates #[11668](https://github.com/archesproject/arches/issues/11668) - Fix bug causing app resources with symlink in their path to not resolve #[11689](https://github.com/archesproject/arches/issues/11689) - Fix bug causing the Edit button to not display in the map popup #[11679](https://github.com/archesproject/arches/issues/11679) +- Fix enabling multiple languages if the `APP_NAME` system settings tile had never been updated #[11660](https://github.com/archesproject/arches/issues/11660) ### Dependency changes: