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