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_PLUGIN_GLOBALSETTING = {}
INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet
INTEGRATION_PLUGINS_RELOADING = False
INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths
# Test settings # Test settings

View File

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