mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
catch db not loaded
This commit is contained in:
parent
23558e235b
commit
f86bd4dd6b
@ -5,6 +5,7 @@ from typing import OrderedDict
|
|||||||
|
|
||||||
from django.apps import AppConfig, apps
|
from django.apps import AppConfig, apps
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db.utils import OperationalError, ProgrammingError
|
||||||
|
|
||||||
|
|
||||||
class PluginConfig(AppConfig):
|
class PluginConfig(AppConfig):
|
||||||
@ -14,6 +15,7 @@ class PluginConfig(AppConfig):
|
|||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
plugins = settings.INTEGRATION_PLUGINS.items()
|
plugins = settings.INTEGRATION_PLUGINS.items()
|
||||||
|
|
||||||
|
try:
|
||||||
# if plugin settings are enabled enhance the settings
|
# if plugin settings are enabled enhance the settings
|
||||||
if settings.TESTING or InvenTreeSetting.get_setting('ENABLE_PLUGINS_SETTING'):
|
if settings.TESTING or InvenTreeSetting.get_setting('ENABLE_PLUGINS_SETTING'):
|
||||||
for slug, plugin in plugins:
|
for slug, plugin in plugins:
|
||||||
@ -44,3 +46,6 @@ class PluginConfig(AppConfig):
|
|||||||
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()
|
||||||
apps.populate(settings.INSTALLED_APPS)
|
apps.populate(settings.INSTALLED_APPS)
|
||||||
|
except (OperationalError, ProgrammingError):
|
||||||
|
# Exception if the database has not been migrated yet
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user