From 047409c6299f07812fea301f5f09e6ea4a754885 Mon Sep 17 00:00:00 2001 From: hyun-park Date: Fri, 12 Jul 2019 12:41:42 +0900 Subject: [PATCH] cors header added --- .gitignore | 2 ++ requirments.txt | 1 + scriptslide/settings.py | 12 ++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ae945fa1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +venv/ diff --git a/requirments.txt b/requirments.txt index ff68172a..23a0355d 100644 --- a/requirments.txt +++ b/requirments.txt @@ -5,6 +5,7 @@ coreschema==0.0.4 defusedxml==0.6.0 Django==2.2.3 django-allauth==0.39.1 +django-cors-headers==3.0.2 django-filter==2.1.0 django-nopassword==5.0.0 django-rest-auth==0.9.5 diff --git a/scriptslide/settings.py b/scriptslide/settings.py index 5a1f0fd5..cc816ccf 100644 --- a/scriptslide/settings.py +++ b/scriptslide/settings.py @@ -48,7 +48,7 @@ 'allauth.account', 'allauth.socialaccount', 'drf_yasg', - + 'corsheaders' ] MIDDLEWARE = [ @@ -59,6 +59,7 @@ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware' ] ROOT_URLCONF = 'scriptslide.urls' @@ -179,4 +180,11 @@ ACCOUNT_EMAIL_REQUIRED = False ACCOUNT_USERNAME_REQUIRED = True #우선은 USERNAME으로만 로그인 -SITE_ID = 1 # rest auth 사용 시 DB 위치 명시localhost에서 \ No newline at end of file +SITE_ID = 1 # rest auth 사용 시 DB 위치 명시localhost에서 + + +CORS_ORIGIN_ALLOW_ALL = True +CORS_ALLOW_CREDENTIALS = True + + +