]> git.parisson.com Git - teleforma.git/commitdiff
add django-cors-headers
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sun, 11 Jan 2026 14:41:06 +0000 (15:41 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sun, 11 Jan 2026 14:41:06 +0000 (15:41 +0100)
app/settings.py
env/staging.yml
poetry.lock
pyproject.toml

index 680cfae9bb2dd68a4f619d8feda7b8f786f35226..9df575d1c43e52cf814799bf0c68f8e675277ddb 100644 (file)
@@ -300,7 +300,7 @@ LOGGING = {
 ########################
 
 MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOLBAR else ()) + (
-    'django.middleware.common.CommonMiddleware',
+    "corsheaders.middleware.CorsMiddleware",
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -309,6 +309,7 @@ MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOL
     'dj_pagination.middleware.PaginationMiddleware',
     'teleforma.middleware.XsSharing',
     'django_user_agents.middleware.UserAgentMiddleware',
+    "django.middleware.common.CommonMiddleware",
 )
 
 INSTALLED_APPS = (
@@ -339,6 +340,7 @@ INSTALLED_APPS = (
     'multichoice',
     'true_false',
     'essay',
+    'corsheaders',
 )
 
 
@@ -670,6 +672,16 @@ BBB_LOGO_URL = "/static/teleforma/images/pb/logo_pb_2025.png"
 BBB_PDF_URL = "/static/teleforma/pdf/pb-blank-slide.pdf"
 BBB_BANNER_COLOR = "#003768"
 
+########################
+# CORS
+########################
+
+CORS_ALLOWED_ORIGINS = [
+    "",
+]
+
+CORS_ALLOW_ALL_ORIGINS = False
+
 ##################
 # LOCAL SETTINGS #
 ##################
index 6d2433a0a0018d12c302e9404988bc4f9aa2be0b..e6193cde7d9f5a0ca4668ced20bf0d80e2f3cf8e 100644 (file)
@@ -11,6 +11,8 @@ services:
     volumes:
       - /mnt/crfpa-videos:/mnt/crfpa-videos
       - /mnt/crfpa-scripts:/mnt/crfpa-scripts
+      - ./pyproject.toml:/srv/pyproject.toml
+      - ./poetry.lock:/srv/poetry.lock
     ports:
       - "9001:8000"
     networks:
@@ -61,4 +63,4 @@ volumes:
 
 networks:
   teleforma-staging:
-    driver: bridge
\ No newline at end of file
+    driver: bridge
index 4f5e13bac1c9726b06f32d146151bc78e13239f0..eeebd5f8d9b3f0199ce23036fc598cce57f022c3 100644 (file)
@@ -670,6 +670,21 @@ sqlparse = ">=0.2.2"
 argon2 = ["argon2-cffi (>=19.1.0)"]
 bcrypt = ["bcrypt"]
 
+[[package]]
+name = "django-cors-headers"
+version = "4.5.0"
+description = "django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS)."
+optional = false
+python-versions = ">=3.9"
+files = [
+    {file = "django_cors_headers-4.5.0-py3-none-any.whl", hash = "sha256:28c1ded847aa70208798de3e42422a782f427b8b720e8d7319d34b654b5978e6"},
+    {file = "django_cors_headers-4.5.0.tar.gz", hash = "sha256:6c01a85cf1ec779a7bde621db853aa3ce5c065a5ba8e27df7a9f9e8dac310f4f"},
+]
+
+[package.dependencies]
+asgiref = ">=3.6"
+django = ">=3.2"
+
 [[package]]
 name = "django-debug-toolbar"
 version = "3.2.1"
@@ -2679,4 +2694,4 @@ testing = ["coverage[toml]", "zope.event", "zope.testing"]
 [metadata]
 lock-version = "2.0"
 python-versions = "^3.10"
-content-hash = "ca43fb92a38a9e734fada4924b41533778853a34317f218cdbcd74c975f3c7a7"
+content-hash = "3573060f68b57a77129e99eec3049bd5092a58d3201ebe312da86f547e30d1dc"
index 65f273210bd4402813437e845b5b2428e892a818..934787d31dc62c620c12fee253654d79e0916d50 100644 (file)
@@ -44,6 +44,7 @@ boto3 = "^1.34.89"
 ipython = "^8.23.0"
 reportlab = "^4.2.0"
 django-quiz-app = {git = "https://github.com/Parisson/Django-Quiz.git", rev = "crfpa"}
+django-cors-headers = "4.5.0"
 
 
 [build-system]