mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
load django internal reloading mechanisms
This commit is contained in:
parent
f13507e23c
commit
9ecf9603d6
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user