Skip to content

Commit ed24438

Browse files
authored
Merge pull request #41 from EventAccess/fix/csrf
Fix CSRF trusted origins
2 parents 27ec5ae + 226d50a commit ed24438

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

config/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
2222

2323
# SECURITY WARNING: keep the secret key used in production secret!
24-
SECRET_KEY = os.getenv(
25-
"DJANGO_SECRET_KEY",
26-
"django-insecure-w^mv=r_(x-se8p#@i*dxfu1^*8$fci+116it+fkj*nx!o2h*r1",
27-
)
24+
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
25+
assert SECRET_KEY, "DJANGO_SECRET_KEY env variable is required"
2826
# SECURITY WARNING: don't run with debug turned on in production!
2927
DEBUG = os.getenv("DJANGO_DEBUG", "False").lower() == "true"
3028

3129
ALLOWED_HOSTS = os.getenv("DJANGO_HOSTS", "*").split(",")
30+
if ALLOWED_HOSTS[0] != "*":
31+
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS]
3232

3333

3434
# Application definition

0 commit comments

Comments
 (0)