From 9cebfa85df1975be9cbb5a353c266a812e30c8fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 23:43:54 +1000 Subject: [PATCH] Add clearer error message for invalid SITE_URL (#7311) (#7312) (cherry picked from commit 2fafb7f21cd3b01bf6a2b2a399c81bf64bbb184a) Co-authored-by: Oliver --- src/backend/InvenTree/InvenTree/settings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/settings.py b/src/backend/InvenTree/InvenTree/settings.py index 13da19b11b..0972fa3b89 100644 --- a/src/backend/InvenTree/InvenTree/settings.py +++ b/src/backend/InvenTree/InvenTree/settings.py @@ -1022,8 +1022,12 @@ if SITE_URL: logger.info('Using Site URL: %s', SITE_URL) # Check that the site URL is valid - validator = URLValidator() - validator(SITE_URL) + try: + validator = URLValidator() + validator(SITE_URL) + except Exception: + print(f"Invalid SITE_URL value: '{SITE_URL}'. InvenTree server cannot start.") + sys.exit(-1) # Enable or disable multi-site framework SITE_MULTI = get_boolean_setting('INVENTREE_SITE_MULTI', 'site_multi', False)