mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
refactor
This commit is contained in:
parent
e70b9bd28f
commit
3dfb8167a7
@ -265,7 +265,7 @@ class PluginAppConfig(AppConfig):
|
|||||||
if settings.INTEGRATION_APPS_LOADING or force_reload:
|
if settings.INTEGRATION_APPS_LOADING or force_reload:
|
||||||
# first startup or force loading of base apps -> registry is prob false
|
# first startup or force loading of base apps -> registry is prob false
|
||||||
settings.INTEGRATION_APPS_LOADING = False
|
settings.INTEGRATION_APPS_LOADING = False
|
||||||
self._reload_apps(populate=True)
|
self._reload_apps(force_reload=True)
|
||||||
self._reload_apps()
|
self._reload_apps()
|
||||||
# rediscover models/ admin sites
|
# rediscover models/ admin sites
|
||||||
self._reregister_contrib_apps()
|
self._reregister_contrib_apps()
|
||||||
@ -383,11 +383,14 @@ class PluginAppConfig(AppConfig):
|
|||||||
urlpatterns[index] = url(f'^{PLUGIN_BASE}/', include((integ_urls, 'plugin')))
|
urlpatterns[index] = url(f'^{PLUGIN_BASE}/', include((integ_urls, 'plugin')))
|
||||||
clear_url_caches()
|
clear_url_caches()
|
||||||
|
|
||||||
|
def _reload_apps(self, force_reload: bool = False):
|
||||||
|
if force_reload:
|
||||||
# we can not use the built in functions as we need to brute force the registry
|
# we can not use the built in functions as we need to brute force the registry
|
||||||
apps.app_configs = OrderedDict()
|
apps.app_configs = OrderedDict()
|
||||||
apps.apps_ready = apps.models_ready = apps.loading = apps.ready = False
|
apps.apps_ready = apps.models_ready = apps.loading = apps.ready = False
|
||||||
apps.clear_cache()
|
apps.clear_cache()
|
||||||
self._try_reload(apps.populate, settings.INSTALLED_APPS)
|
self._try_reload(apps.populate, settings.INSTALLED_APPS)
|
||||||
|
|
||||||
settings.INTEGRATION_PLUGINS_RELOADING = True
|
settings.INTEGRATION_PLUGINS_RELOADING = True
|
||||||
self._try_reload(apps.set_installed_apps, settings.INSTALLED_APPS)
|
self._try_reload(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