From: Guillaume Pellerin Date: Sun, 11 Jan 2026 14:41:06 +0000 (+0100) Subject: add django-cors-headers X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=77bc7363fa96437b506ff8969745bd18c68ea1c1;p=teleforma.git add django-cors-headers --- diff --git a/app/settings.py b/app/settings.py index 680cfae9..9df575d1 100644 --- a/app/settings.py +++ b/app/settings.py @@ -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 # ################## diff --git a/env/staging.yml b/env/staging.yml index 6d2433a0..e6193cde 100644 --- a/env/staging.yml +++ b/env/staging.yml @@ -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 diff --git a/poetry.lock b/poetry.lock index 4f5e13ba..eeebd5f8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 65f27321..934787d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]