From 30da4738eee6c2436dd6f4d879069c0e3713eec6 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Tue, 9 Nov 2021 22:23:03 +0100 Subject: add cors --- lom_api/settings.py | 7 +++++-- python.req | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lom_api/settings.py b/lom_api/settings.py index 7c85027..a09c7a7 100644 --- a/lom_api/settings.py +++ b/lom_api/settings.py @@ -26,6 +26,7 @@ SECRET_KEY = 'django-insecure-w699xg1453&j057k$g465vldjn+4*skp8!13ua=aq0s_91b@c) DEBUG = True ALLOWED_HOSTS = ['*'] +CORS_ORIGIN_ALLOW_ALL = True # Application definition @@ -39,6 +40,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'knox', + 'corsheaders', 'auth_api', 'chat_api' ] @@ -48,9 +50,9 @@ REST_FRAMEWORK = { } REST_KNOX = { - 'TOKEN_LIMIT_PER_USER': 1, +# 'TOKEN_LIMIT_PER_USER': 1, } - + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -59,6 +61,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', ] ROOT_URLCONF = 'lom_api.urls' diff --git a/python.req b/python.req index 9a4a7c2..4f2ded4 100644 --- a/python.req +++ b/python.req @@ -2,6 +2,7 @@ asgiref==3.4.1 cffi==1.15.0 cryptography==35.0.0 Django==3.2.9 +django-cors-headers==3.10.0 django-rest-knox==4.1.0 djangorestframework==3.12.4 pycparser==2.21 -- cgit v1.2.3