From de4f49973f08027f0818c5780dd65517eb3c575e Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 28 Jun 2018 16:37:21 +0100 Subject: [PATCH] Disable CORS altogether. This solves #4 better than dfc7c8b1639710a6a03712c65c7ef14dd2a4237b --- etesync_server/settings.py | 5 +++++ requirements.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/etesync_server/settings.py b/etesync_server/settings.py index bc44337..521cb2f 100644 --- a/etesync_server/settings.py +++ b/etesync_server/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'corsheaders', 'rest_framework', 'rest_framework.authtoken', 'journal.apps.JournalConfig', @@ -48,6 +49,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -130,3 +132,6 @@ STATIC_URL = '/static/' JOURNAL_API_PERMISSIONS = ( 'rest_framework.permissions.IsAuthenticated', ) + +# Cors +CORS_ORIGIN_ALLOW_ALL = True diff --git a/requirements.txt b/requirements.txt index 03d8859..65d8a96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ Django>=2.0.5,<2.0.999 +django-cors-headers==2.3.0 djangorestframework>=3.8.2,<3.8.999 drf-nested-routers==0.90.2 pytz