diff --git a/requirements.txt b/requirements.txt index 11f4159..2dc4dc9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,8 @@ asgiref==3.7.2 Django==4.2.6 +django-cors-headers==4.3.0 +django-restapi==0.1.3 +djangorestframework==3.14.0 +install==1.3.5 +pytz==2023.3.post1 sqlparse==0.4.4 diff --git a/trancendence/settings.py b/trancendence/settings.py index b6cb791..6aa5548 100644 --- a/trancendence/settings.py +++ b/trancendence/settings.py @@ -29,6 +29,11 @@ CSRF_TRUSTED_ORIGINS = ['https://code.chauvet.pro', 'https://django.chauvet.pro' ALLOWED_HOSTS = ["*"] +CORS_ORIGIN_ALLOW_ALL = False + +CORS_ORIGIN_WHITELIST = ( + 'http://localhost:8000', +) # Application definition @@ -36,6 +41,8 @@ INSTALLED_APPS = [ 'accounts.apps.AccountsConfig', 'profiles.apps.ProfilesConfig', + 'corsheaders', + 'rest_framework', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -45,6 +52,8 @@ INSTALLED_APPS = [ ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.common.CommonMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware',