
[Python] Django 투표 앱과 frontend 연결하기
·
Language/Python
frontend 연결하기투표 앱 프로젝트에 “django-cors-headers” 종속성 추가uv add django-cors-headers settings.py 수정INSTALLED_APPS에 'corsheaders' 추가MIDDLEWARE에 'corsheaders.middleware.CorsMiddleware’ 추가 요청을 허용할 origin을 선택, 허용할 메소드와 헤더도 추가CORS_ALLOWED_ORIGINS = [ "http://localhost:3000", "http://127.0.0.1:3000",]CSRF_TRUSTED_ORIGINS = [ "http://localhost:3000", "http://127.0.0.1:3000",]# 허용할 메소드와 헤더CORS_ALL..