From 24a8c3469963743223a1882d07bc64a1e00a260a Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 19 Oct 2021 21:42:29 +0200 Subject: [PATCH] only check if plugin urls are enabled if db ready --- InvenTree/InvenTree/urls.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index e181d130fa..2bd04b009b 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -31,6 +31,7 @@ from report.api import report_api_urls from django.conf import settings from django.conf.urls.static import static +from django.db.utils import OperationalError, ProgrammingError from django.views.generic.base import RedirectView from rest_framework.documentation import include_docs_urls @@ -127,15 +128,14 @@ translated_javascript_urls = [ # Integration plugin urls interation_urls = [] -plugin_url_enabled = False try: - plugin_url_enabled = InvenTreeSetting.get_setting('ENABLE_PLUGINS_URL') -except Exception as _e: - print(_e) -if settings.TESTING or plugin_url_enabled: - for plugin in settings.INTEGRATION_PLUGINS.values(): - if plugin.mixin_enabled('urls'): - interation_urls.append(plugin.urlpatterns) + if settings.TESTING or InvenTreeSetting.get_setting('ENABLE_PLUGINS_URL'): + for plugin in settings.INTEGRATION_PLUGINS.values(): + if plugin.mixin_enabled('urls'): + interation_urls.append(plugin.urlpatterns) +except (OperationalError, ProgrammingError): + # Exception if the database has not been migrated yet + pass urlpatterns = [ url(r'^part/', include(part_urls)),