【发布时间】:2022-01-04 21:41:02
【问题描述】:
我还是新手反应 在我的情况下,当我尝试从 API(django rest 框架)中删除一个元素时,它不起作用 错误信息 : 从源“http://localhost:3000”访问“http://127.0.0.1:8000/api/events/delete/3”的 XMLHttpRequest 已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:预检请求不允许重定向。enter image description here
【问题讨论】:
-
你可以尝试将
"proxy": "http://localhost:8000"添加到你的React项目的package.json -
pip install django-cors-headers。安装此软件包 pypi.org/project/django-cors-headers 您访问此站点以获取完整文档。
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: reactjs django django-rest-framework permissions