diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 5a3d015..5b854ca 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -45,12 +45,6 @@ jobs: run: | python3 manage.py test - - ### makemigration & migrate 이부분은 CI/CD가 진행되면 db가 날라가기에 db를 분리하는 게 좋아보임 - - name: migrate - run: | - python3 manage.py migrate - ### Docker Image Build and Push ### - name: Login to Docker Hub if: github.event.pull_request.merged == true diff --git a/project/settings.py b/project/settings.py index e1038e8..ff0f3a0 100644 --- a/project/settings.py +++ b/project/settings.py @@ -42,6 +42,7 @@ 'django.contrib.staticfiles', 'rest_framework', 'django_filters', + 'corsheaders', # API명세서 확인용 'drf_yasg', @@ -60,6 +61,7 @@ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', ] ROOT_URLCONF = 'project.urls' @@ -82,6 +84,19 @@ WSGI_APPLICATION = 'project.wsgi.application' +# CORS 관련 추가 +CORS_ALLOW_ALL_ORIGINS = False +CORS_ALLOW_CREDENTIALS = True + +CORS_ALLOWED_ORIGINS = [ + 'http://127.0.0.1', + 'http://127.0.0.1:3000', + 'http://127.0.0.1:5173', + + 'http://localhost', + 'http://localhost:3000', + 'http://localhost:5173', +] # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases diff --git a/requirements.txt b/requirements.txt index e193f72..813eaa2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ asgiref==3.7.2 Django==4.2.5 +django-cors-headers==4.2.0 django-filter==23.3 djangorestframework==3.14.0 drf-yasg==1.21.7