From 929485a8f97f28fb3e7c3432249ac1c07a6cf192 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 19 Feb 2025 09:39:22 +0100 Subject: [PATCH] [ADD] Check for empty `SITE_URL` --- allianceauth/checks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/allianceauth/checks.py b/allianceauth/checks.py index aae8b9c1..cceabbfc 100644 --- a/allianceauth/checks.py +++ b/allianceauth/checks.py @@ -31,8 +31,10 @@ def django_settings(app_configs, **kwargs) -> List[CheckMessage]: # SITE_URL if hasattr(settings, "SITE_URL"): - if settings.SITE_URL[-1] == "/": - errors.append(Warning("'SITE_URL' Has a trailing slash. This may lead to incorrect links being generated by Auth.", hint="", id="allianceauth.checks.B005")) + if settings.SITE_URL == "": + errors.append(Error("'SITE_URL' is empty.", hint="Make sure to set 'SITE_URL' to the URL of your Auth instance. (Without trailing slash)", id="allianceauth.checks.B011")) + elif settings.SITE_URL[-1] == "/": + errors.append(Warning("'SITE_URL' has a trailing slash. This may lead to incorrect links being generated by Auth.", hint="", id="allianceauth.checks.B005")) else: errors.append(Error("No 'SITE_URL' found is settings. This may lead to incorrect links being generated by Auth or Errors in 3rd party modules.", hint="", id="allianceauth.checks.B006"))