Add CORS headers and update installed apps in settings.py

This commit is contained in:
Jean Lionel Ndabaga 2024-03-10 23:05:28 +02:00
parent 00407ea767
commit d9cdada41f
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,3 @@
from django.shortcuts import render
# Create your views here.
# Create your views here.

View file

@ -41,11 +41,13 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'api',
'rest_framework',
'corsheaders',
'api',
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@ -133,3 +135,8 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
CORS_ORIGIN_WHITELIST = [
"http://localhost:5173",
"http://localhost:5174"
]