Skip to content

Commit eaca85f

Browse files
committed
- chore: add cors configurations
1 parent 11f7f4c commit eaca85f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@
3737
'django.contrib.messages',
3838
'django.contrib.staticfiles',
3939

40+
'corsheaders',
4041
'rest_framework',
4142
'api',
4243
'api.user',
4344
'api.authentication'
4445
]
4546

4647
MIDDLEWARE = [
48+
'corsheaders.middleware.CorsMiddleware',
4749
'django.middleware.security.SecurityMiddleware',
4850
'django.contrib.sessions.middleware.SessionMiddleware',
4951
'django.middleware.common.CommonMiddleware',
@@ -136,4 +138,8 @@
136138
),
137139
}
138140

141+
CORS_ALLOWED_ORIGINS = [
142+
"http://localhost:3000",
143+
"http://127.0.0.1:3000"
144+
]
139145

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Django==3.2.5
22
djangorestframework==3.12.4
3-
PyJWT==2.1.0
3+
PyJWT==2.1.0
4+
django-cors-headers==3.7.0

0 commit comments

Comments
 (0)