diff --git a/poizonstore/settings.py b/poizonstore/settings.py index 9f59089..48b8382 100644 --- a/poizonstore/settings.py +++ b/poizonstore/settings.py @@ -32,6 +32,14 @@ ALLOWED_HOSTS = ["crm-poizonstore.ru", "127.0.0.1", "localhost", "45.84.227.72"] INTERNAL_IPS = ["127.0.0.1"] +CORS_ALLOWED_ORIGINS = [ + "http://crm-poizonstore.ru/", + "https://crm-poizonstore.ru/", + + "http://localhost:8001", + "https://localhost:8001", +] + AUTH_USER_MODEL = 'store.User' @@ -45,6 +53,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', + 'corsheaders', 'django_cleanup.apps.CleanupSelectedConfig', 'rest_framework', 'debug_toolbar', @@ -54,6 +63,7 @@ INSTALLED_APPS = [ ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/requirements.txt b/requirements.txt index 1ef668c..2f6c8b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ Django==4.2.2 django-cleanup==8.0.0 django-filter==23.2 djangorestframework==3.14.0 +django-cors-headers==4.1.0 drf-extra-fields==3.5.0 Pillow==9.5.0