From 469c2c15c684a32e2f947f3da713699b1c8a6161 Mon Sep 17 00:00:00 2001 From: d0c Date: Fri, 3 Mar 2023 17:21:49 +0100 Subject: [PATCH] cors --- mysuitablephone/settings.py | 6 ++++++ requirements.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/mysuitablephone/settings.py b/mysuitablephone/settings.py index 7d467d5..a494eb8 100644 --- a/mysuitablephone/settings.py +++ b/mysuitablephone/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ 'django_filters', 'rest_framework', 'suitablephones', + 'corsheaders', ] MIDDLEWARE = [ @@ -50,6 +51,11 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', +] + +CORS_ORIGIN_WHITELIST = [ + "http://localhost:5173", ] ROOT_URLCONF = 'mysuitablephone.urls' diff --git a/requirements.txt b/requirements.txt index 50911a6..eb87fea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ djangorestframework markdown django-filter psycopg2-binary +django-cors-headers