diff --git a/config/settings/base.py b/config/settings/base.py index 70c5d1b..dcfc443 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -46,6 +46,7 @@ PACKAGES = [ 'rest_framework', 'rest_framework_simplejwt', 'cacheops', + 'corsheaders', ] INSTALLED_APPS = [] @@ -58,6 +59,7 @@ INSTALLED_APPS += APPS MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -151,4 +153,13 @@ from config.conf.rest_framework import * from config.conf.simplejwt import * from config.conf.celery import * from config.conf.redis import * -# from config.conf.unfold import * \ No newline at end of file +# from config.conf.unfold import * + + +CORS_ALLOWED_ORIGINS = [ + "http://localhost:3000", +] + +CSRF_TRUSTED_ORIGINS = [ + "http://trustme.felixits.uz" +] diff --git a/requirements.txt b/requirements.txt index e917520..16bc259 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ pytest-django django-cacheops==7.2 django-unfold==0.62.0 drf_yasg==1.21.10 +django-cors-headers==4.7.0 \ No newline at end of file