Skip to content

Commit 20a175f

Browse files
yochannahDennis Schwartz
authored andcommitted
add support for CORS
1 parent 3b9d8c9 commit 20a175f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

biojs/settings.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@
4141
'django.contrib.sessions',
4242
'django.contrib.messages',
4343
'django.contrib.staticfiles',
44+
'corsheaders',
4445
'main',
4546
'rest_framework',
4647
]
4748

4849
MIDDLEWARE = [
50+
'corsheaders.middleware.CorsMiddleware',
4951
'django.middleware.security.SecurityMiddleware',
5052
'django.contrib.sessions.middleware.SessionMiddleware',
5153
'django.middleware.common.CommonMiddleware',
@@ -152,3 +154,12 @@
152154

153155
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
154156
MEDIA_URL = '/backend_media/'
157+
158+
# CORS settings
159+
160+
CORS_ORIGIN_WHITELIST = (
161+
'biojs.net',
162+
'biojs.io',
163+
'localhost:8080',
164+
'127.0.0.1:9000'
165+
)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
certifi==2018.4.16
1+
certifi
22
chardet==3.0.4
33
Django==1.11.13
44
django-redis==4.9.0

0 commit comments

Comments
 (0)