Add CORS support to allow cross origin API requests

This commit is contained in:
Roberto Rosario
2014-09-21 14:59:11 -04:00
parent 1050fc71af
commit 2878bac07d
2 changed files with 6 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ INSTALLED_APPS = (
'django.contrib.comments',
'django.contrib.staticfiles',
# 3rd party
'corsheaders',
'south',
'rest_framework_swagger',
'filetransfers',
@@ -102,6 +103,7 @@ INSTALLED_APPS = (
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -262,3 +264,6 @@ REST_FRAMEWORK = {
'rest_framework.authentication.SessionAuthentication',
)
}
# CORS
CORS_ORIGIN_ALLOW_ALL = True

View File

@@ -6,6 +6,7 @@ Django==1.6.5
django-filetransfers==0.1.0
django-pagination==1.0.7
django-compressor==1.4
django-cors-headers==0.13
django-taggit==0.12
django-mptt==0.6.1
django-rest-swagger==0.1.14