[ADD] Check for empty SITE_URL

This commit is contained in:
Peter Pfeufer 2025-02-19 09:39:22 +01:00
parent 28cb62f373
commit 929485a8f9
No known key found for this signature in database

View File

@ -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"))