From d6bd3adf5cbb3ae499966ec34376ea88ba756d0f Mon Sep 17 00:00:00 2001 From: Jakub K Date: Fri, 22 Dec 2023 20:59:18 +0100 Subject: [PATCH] corsorigins --- izaac/settings.py | 10 +++++++++- requirements.txt | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/izaac/settings.py b/izaac/settings.py index 09954fa..04b767b 100644 --- a/izaac/settings.py +++ b/izaac/settings.py @@ -27,8 +27,14 @@ SECRET_KEY = "django-insecure-ztiqj957k(j*@ms=-^9j+=j7wd+cyo*+9g&hkfh1bji-@#&6(e # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['izaac.izaac.pl', 'localhost', '127.0.0.1'] +ALLOWED_HOSTS = ['izaac.izaac.pl', 'localhost', '127.0.0.1',] +CORS_ALLOWED_ORIGIN = [ + "http://localhost:8000", + "http://izaac.izaac.pl", + "http://izaac-frontend.izaac.pl", + "http://izaac-backend.izaac.pl", +] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ @@ -50,6 +56,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", 'django.contrib.sites', + "corsheaders", "rest_framework", "rest_framework.authtoken", "dj_rest_auth", @@ -70,6 +77,7 @@ ACCOUNT_EMAIL_VERIFICATION = 'none' # Lub 'mandatory' jeśli chcesz wymagać we 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", diff --git a/requirements.txt b/requirements.txt index cba7d94..321c6de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ gunicorn djangorestframework psycopg2-binary django-allauth -dj-rest-auth \ No newline at end of file +dj-rest-auth +django-cors-headers \ No newline at end of file