Skip to content

Commit

Permalink
Configure CORS headers for the dashboard
Browse files Browse the repository at this point in the history
Add Cross-Origin Resources Sharing (CORS) HTTP headers to the responses
so that web browsers allow access to the API endpoints from different
domains too.
  • Loading branch information
suutari-ai committed Feb 9, 2018
1 parent db38644 commit f47f4ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parkkihubi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'django.contrib.staticfiles',
'django.contrib.gis',
'raven.contrib.django.raven_compat',
'corsheaders',
'rest_framework',
'rest_framework.authtoken',
'rest_framework_gis',
Expand All @@ -88,6 +89,7 @@
##############
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'parkkihubi.middleware.AdminTimezoneMiddleware',
Expand Down Expand Up @@ -164,6 +166,7 @@
'TEST_REQUEST_DEFAULT_FORMAT': 'json',
}

CORS_ORIGIN_ALLOW_ALL = True

##############
# Parkkihubi #
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ owslib

# Misc
pytz
django-cors-headers
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
certifi==2018.1.18 # via requests
chardet==3.0.4 # via requests
django==1.11.9
django-cors-headers==2.1.0
django-environ==0.4.4
django-filter==1.1.0
djangorestframework==3.7.7
Expand Down

0 comments on commit f47f4ac

Please sign in to comment.