Add Gitpod config for CSRF origin

Supports CSRF with Django 4+ (Baby Buddy v1.10.0+).

See #393.
This commit is contained in:
Christopher Charbonneau Wells 2022-02-20 22:27:19 +00:00
parent 741548edf2
commit 26fa988fe6
3 changed files with 11 additions and 1 deletions

View File

@ -6,7 +6,7 @@ tasks:
gulp migrate &&
gulp createcachetable
env:
DJANGO_SETTINGS_MODULE: babybuddy.settings.development
DJANGO_SETTINGS_MODULE: babybuddy.settings.gitpod
command: gulp
ports:

View File

@ -3,6 +3,7 @@
!base.py
!ci.py
!development.py
!gitpod.py
!heroku.py
!production.example.py
!test.py

View File

@ -0,0 +1,9 @@
from .development import *
# CSRF configuration
# https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-CSRF_TRUSTED_ORIGINS
# https://www.gitpod.io/docs/environment-variables/#default-environment-variables
CSRF_TRUSTED_ORIGINS = [
os.environ.get("GITPOD_WORKSPACE_URL").replace("https://", "https://8000-")
]