Skip to content

Commit

Permalink
Merge pull request #19 from chaeunho1227/ceh
Browse files Browse the repository at this point in the history
✨ feat : cors 설정 추가
  • Loading branch information
IAMBH authored Oct 2, 2023
2 parents d0618fa + 1393fc2 commit eff632e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'django.contrib.staticfiles',
'rest_framework',
'django_filters',
'corsheaders',
# API명세서 확인용
'drf_yasg',

Expand All @@ -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'
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit eff632e

Please sign in to comment.