load django internal reloading mechanisms

This commit is contained in:
Matthias 2021-11-14 23:08:28 +01:00
parent f13507e23c
commit 9ecf9603d6
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 7 additions and 7 deletions

View File

@ -866,6 +866,7 @@ INTEGRATION_PLUGINS_INACTIVE = {}
INTEGRATION_PLUGIN_GLOBALSETTING = {}
INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet
INTEGRATION_PLUGINS_RELOADING = False
INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths
# Test settings

View File

@ -26,8 +26,9 @@ class PluginAppConfig(AppConfig):
name = 'plugin'
def ready(self):
self._collect_plugins()
self.load_plugins()
if not settings.INTEGRATION_PLUGINS_RELOADING:
self._collect_plugins()
self.load_plugins()
# region public plugin functions
def load_plugins(self):
@ -224,10 +225,8 @@ class PluginAppConfig(AppConfig):
print('done')
def _reload_apps(self):
# TODO this is a bit jankey to be honest
apps.app_configs = OrderedDict()
apps.apps_ready = apps.models_ready = apps.loading = apps.ready = False
apps.clear_cache()
apps.populate(settings.INSTALLED_APPS)
settings.INTEGRATION_PLUGINS_RELOADING = True
apps.set_installed_apps(settings.INSTALLED_APPS)
settings.INTEGRATION_PLUGINS_RELOADING = False
# endregion
# endregion