From ff0c49c63e4b99ae368652a6f17e87c52fe7596c Mon Sep 17 00:00:00 2001 From: UsamaSadiq Date: Tue, 3 Oct 2023 18:23:26 +0500 Subject: [PATCH] feat: add csrf_trusted_origins_with_scheme setting --- analytics_dashboard/settings/base.py | 3 +++ analytics_dashboard/settings/production.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/analytics_dashboard/settings/base.py b/analytics_dashboard/settings/base.py index 523a9f1c5..ebb067719 100644 --- a/analytics_dashboard/settings/base.py +++ b/analytics_dashboard/settings/base.py @@ -515,3 +515,6 @@ # See https://openedx.atlassian.net/wiki/spaces/AC/pages/3066626061/Django+3.2+Upgrade+Key+Changes DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' DEFAULT_HASHING_ALGORITHM = 'sha1' + +CSRF_TRUSTED_ORIGINS = [] +CSRF_TRUSTED_ORIGINS_WITH_SCHEME = [] # temporary setting for Django 4.2 support diff --git a/analytics_dashboard/settings/production.py b/analytics_dashboard/settings/production.py index 523fa8fce..fad1c6713 100644 --- a/analytics_dashboard/settings/production.py +++ b/analytics_dashboard/settings/production.py @@ -1,5 +1,7 @@ """Production settings and globals.""" +import django + from analytics_dashboard.settings.base import * from analytics_dashboard.settings.logger import get_logger_config from analytics_dashboard.settings.yaml_config import * @@ -36,3 +38,6 @@ # Use Cloudfront CDN for assets if CDN_DOMAIN: STATIC_URL = 'https://' + CDN_DOMAIN + '/static/' + +if django.VERSION[0] >= 4: # for greater than django 3.2 use schemes. + CSRF_TRUSTED_ORIGINS = CSRF_TRUSTED_ORIGINS_WITH_SCHEME