From df7c5ba23402e522c8401dba0a0e085752897c6a Mon Sep 17 00:00:00 2001 From: master3395 Date: Tue, 3 Feb 2026 19:09:46 +0100 Subject: [PATCH] Only include plugin URLs when app is in INSTALLED_APPS Skip dynamic plugin URL inclusion for plugins that are on disk but not in Django INSTALLED_APPS to avoid RuntimeError when loading models. Plugin installer adds apps to INSTALLED_APPS on install; this prevents breakage when that step was missed or reverted. --- pluginHolder/urls.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pluginHolder/urls.py b/pluginHolder/urls.py index 5eefc03e6..4bc0c147b 100644 --- a/pluginHolder/urls.py +++ b/pluginHolder/urls.py @@ -99,7 +99,13 @@ urlpatterns = [ ] # Dynamically include each installed plugin's URLs so /plugins//settings/ etc. work +# Only include plugins that are in INSTALLED_APPS so Django can load their models. +from django.conf import settings +_installed_apps = getattr(settings, 'INSTALLED_APPS', ()) + for _plugin_name, _path_parent in _get_installed_plugin_list(): + if _plugin_name not in _installed_apps: + continue try: # If plugin is from a source path, ensure it is on sys.path so import works if _path_parent not in sys.path: