mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-07 07:48:50 +00:00
fix initial startup phase
This commit is contained in:
parent
eb02a85154
commit
47bb9466b7
@ -865,7 +865,7 @@ INTEGRATION_PLUGINS = {}
|
|||||||
INTEGRATION_PLUGINS_INACTIVE = {}
|
INTEGRATION_PLUGINS_INACTIVE = {}
|
||||||
INTEGRATION_PLUGIN_GLOBALSETTING = {}
|
INTEGRATION_PLUGIN_GLOBALSETTING = {}
|
||||||
|
|
||||||
INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet
|
INTEGRATION_APPS_LOADING = True # Marks if apps were reloaded yet
|
||||||
INTEGRATION_PLUGINS_RELOADING = False
|
INTEGRATION_PLUGINS_RELOADING = False
|
||||||
INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths
|
INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths
|
||||||
|
|
||||||
|
@ -172,9 +172,8 @@ class PluginAppConfig(AppConfig):
|
|||||||
def activate_integration_app(self, plugins):
|
def activate_integration_app(self, plugins):
|
||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
|
|
||||||
if settings.PLUGIN_TESTING or ((not settings.INTEGRATION_APPS_LOADED) and InvenTreeSetting.get_setting('ENABLE_PLUGINS_APP')):
|
if settings.PLUGIN_TESTING or (settings.INTEGRATION_APPS_LOADING and InvenTreeSetting.get_setting('ENABLE_PLUGINS_APP')):
|
||||||
logger.info('Registering IntegrationPlugin apps')
|
logger.info('Registering IntegrationPlugin apps')
|
||||||
settings.INTEGRATION_APPS_LOADED = True # ensure this section will not run again
|
|
||||||
apps_changed = False
|
apps_changed = False
|
||||||
|
|
||||||
# add them to the INSTALLED_APPS
|
# add them to the INSTALLED_APPS
|
||||||
@ -188,6 +187,9 @@ class PluginAppConfig(AppConfig):
|
|||||||
|
|
||||||
if apps_changed:
|
if apps_changed:
|
||||||
# if apps were changed reload
|
# if apps were changed reload
|
||||||
|
if settings.INTEGRATION_APPS_LOADING:
|
||||||
|
settings.INTEGRATION_APPS_LOADING = False
|
||||||
|
self._reload_apps(populate=True)
|
||||||
self._reload_apps()
|
self._reload_apps()
|
||||||
# update urls
|
# update urls
|
||||||
self._update_urls()
|
self._update_urls()
|
||||||
@ -224,7 +226,13 @@ class PluginAppConfig(AppConfig):
|
|||||||
break
|
break
|
||||||
print('done')
|
print('done')
|
||||||
|
|
||||||
def _reload_apps(self):
|
def _reload_apps(self, populate: bool = False):
|
||||||
|
if populate:
|
||||||
|
apps.app_configs = OrderedDict()
|
||||||
|
apps.apps_ready = apps.models_ready = apps.loading = apps.ready = False
|
||||||
|
apps.clear_cache()
|
||||||
|
apps.populate(settings.INSTALLED_APPS)
|
||||||
|
return
|
||||||
settings.INTEGRATION_PLUGINS_RELOADING = True
|
settings.INTEGRATION_PLUGINS_RELOADING = True
|
||||||
apps.set_installed_apps(settings.INSTALLED_APPS)
|
apps.set_installed_apps(settings.INSTALLED_APPS)
|
||||||
settings.INTEGRATION_PLUGINS_RELOADING = False
|
settings.INTEGRATION_PLUGINS_RELOADING = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user