2024. 4. 26. 17:52

1. pip install django-cors-headers

 

2. settings.py 

 

INSTALLED_APPS = [

  'corsheaders'

]

 

3. MIDDLEWARE = [

  'corsheaders.middleware.CorsMiddleware', 

]

 

4. CORS_ALLOWED_ORIGINS = [

  'http://localhost:5173' # 보내는 클라이언트 주소

]

 

5. CORS_ALLOW_CREDENTIALS = True