Add clearer error message for invalid SITE_URL (#7311)

This commit is contained in:
Oliver 2024-05-23 23:39:25 +10:00 committed by GitHub
parent f2ab3bdca2
commit 2fafb7f21c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1016,8 +1016,12 @@ if SITE_URL:
logger.info('Using Site URL: %s', SITE_URL) logger.info('Using Site URL: %s', SITE_URL)
# Check that the site URL is valid # Check that the site URL is valid
try:
validator = URLValidator() validator = URLValidator()
validator(SITE_URL) 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 # Enable or disable multi-site framework
SITE_MULTI = get_boolean_setting('INVENTREE_SITE_MULTI', 'site_multi', False) SITE_MULTI = get_boolean_setting('INVENTREE_SITE_MULTI', 'site_multi', False)