Added corsheader

This commit is contained in:
keannu125 2023-02-28 22:40:37 +08:00
parent dab99b17cf
commit 62237c9a3c

View file

@ -40,11 +40,13 @@ INSTALLED_APPS = [
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',
'djoser', 'djoser',
'corsheaders',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
"corsheaders.middleware.CorsMiddleware",
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
@ -141,3 +143,7 @@ EMAIL_HOST = 'sandbox.smtp.mailtrap.io'
EMAIL_HOST_USER = '54ff6949e39105' EMAIL_HOST_USER = '54ff6949e39105'
EMAIL_HOST_PASSWORD = 'c59d3eaa05f98d' EMAIL_HOST_PASSWORD = 'c59d3eaa05f98d'
EMAIL_PORT = '2525' EMAIL_PORT = '2525'
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
]