본문 바로가기
TIL

[TIL]2023.06.12

by kming 2023. 6. 12.

.0.1:8000/article/' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

 

해결방법

django-cors-headers 설치
settings.py에
MIDDLEWARE = [
 
    'corsheaders.middleware.CorsMiddleware',
 
]
 
INSTALLED_APPS = [
 
    'corsheaders',
 
]
 
CORS_ORIGIN_ALLOW_ALL = True        추가
 

 

'TIL' 카테고리의 다른 글

[TIL]2023.06.20 /자바스크립트로 모달창 만들기/  (0) 2023.06.20
[TIL]2023.06.09  (0) 2023.06.09
[TIL]2023.06.07  (0) 2023.06.07
[TIL]2023.05.15 /KPT/  (0) 2023.05.15
[TIL]2023.05.11 / @classmethod /  (0) 2023.05.11