From 4a37e6126596cb1699e7115c8abb16245c0db625 Mon Sep 17 00:00:00 2001 From: Marc Koch Date: Fri, 25 Apr 2025 17:33:11 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20csrf=20env=20settion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/booking.py | 5 ++++- version.txt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/booking.py b/src/booking.py index f1fe95f..6c07355 100644 --- a/src/booking.py +++ b/src/booking.py @@ -7,6 +7,7 @@ import markdown import requests import shortuuid +from django.conf.global_settings import CSRF_TRUSTED_ORIGINS from django.core.validators import URLValidator from django.db import models from django.shortcuts import render, get_object_or_404 @@ -32,13 +33,15 @@ app = Django( SECRET_KEY=DJANGO_SECRET_KEY, TIME_ZONE=os.getenv("TIME_ZONE", "Europe/Berlin"), ALLOWED_HOSTS=["localhost"] + [host for host in - os.getenv("ALLOWED_HOSTS", "").split(",")], + os.getenv("DJANGO_ALLOWED_HOSTS", "").split(",")], SQLITE_DATABASE=DATA_DIR / "db.sqlite3", DEBUG=DEBUG, TEMPLATES_DIR=BASE_DIR / "templates", STATICFILES_DIRS=[ BASE_DIR / "static", ], + CSRF_TRUSTED_ORIGINS=[host for host in + os.getenv("DJANGO_ALLOWED_HOSTS", "").split(",")] ) # Import ninja after nanodjango has been initialised to avoid this error: diff --git a/version.txt b/version.txt index e6d5cb8..e4c0d46 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file