Skip to content

Commit e11ee30

Browse files
committed
add cors
1 parent cba1161 commit e11ee30

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

server/Django-Backend/config/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,23 @@
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
4040
'linker.apps.LinkerConfig',
41-
'rest_framework'
41+
'rest_framework',
42+
'corsheaders'
4243
]
4344

4445
MIDDLEWARE = [
4546
'django.middleware.security.SecurityMiddleware',
4647
'django.contrib.sessions.middleware.SessionMiddleware',
48+
'corsheaders.middleware.CorsMiddleware',
4749
'django.middleware.common.CommonMiddleware',
4850
'django.middleware.csrf.CsrfViewMiddleware',
4951
'django.contrib.auth.middleware.AuthenticationMiddleware',
5052
'django.contrib.messages.middleware.MessageMiddleware',
5153
'django.middleware.clickjacking.XFrameOptionsMiddleware',
5254
]
5355

56+
CORS_ALLOW_CREDENTIALS = True
57+
CORS_ALLOW_ALL_ORIGINS = True
5458
# For Production Only
5559
REST_FRAMEWORK = {
5660
'DEFAULT_RENDERER_CLASSES': (

server/Django-Backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ asttokens==2.4.1
33
colorama==0.4.6
44
decorator==5.1.1
55
Django==5.0.6
6+
django-cors-headers==4.4.0
67
djangorestframework==3.15.2
78
executing==2.0.1
89
ipython==8.26.0

0 commit comments

Comments
 (0)