mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-05 22:29:05 +01:00
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.
This commit is contained in:
@@ -99,7 +99,13 @@ urlpatterns = [
|
||||
]
|
||||
|
||||
# Dynamically include each installed plugin's URLs so /plugins/<plugin_name>/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:
|
||||
|
||||
Reference in New Issue
Block a user