Fix allowed hosts

This commit is contained in:
Kumi 2023-07-08 20:00:35 +02:00
parent a6f0f8cd07
commit f45f7bdac4
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 8 additions and 2 deletions

View file

@ -16,7 +16,13 @@ DEBUG = CONFIG.get('KumiSystems', 'Debug', fallback=False)
HOST = CONFIG.get('KumiSystems', 'Host', fallback='localhost') HOST = CONFIG.get('KumiSystems', 'Host', fallback='localhost')
ALLOWED_HOSTS = [HOST] ALLOWED_HOSTS = [HOST]
CSRF_TRUSTED_ORIGINS = [f"https://{HOST}"]
if HOST.startswith("www."):
ALLOWED_HOSTS.append(HOST[4:])
else:
ALLOWED_HOSTS.append(f"www.{HOST}")
CSRF_TRUSTED_ORIGINS = [f"https://{HOST}" for HOST in ALLOWED_HOSTS]
SITE_ID = CONFIG.getint('KumiSystems', 'SiteID', fallback=1) SITE_ID = CONFIG.getint('KumiSystems', 'SiteID', fallback=1)

View file

@ -15,7 +15,7 @@ def main():
"available on your PYTHONPATH environment variable? Did you " "available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?" "forget to activate a virtual environment?"
) from exc ) from exc
execute_from_command_line(sys.argv)
if __name__ == "__main__": if __name__ == "__main__":