Access to XMLHttpRequest at from origin has been blocked by CORS policy: No ‘Access-Control-Allow-Or

时间:2024-04-09 19:50:43

Access to XMLHttpRequest at from origin has been blocked by CORS policy: No ‘Access-Control-Allow-Or
前端提交信息时遇到这个错误,查了一下是跨域问题。

参考下面的博客,
添加链接描述

按照博客中说的改了一下settings
但是运行了一下出错了,说是找不到模块
Access to XMLHttpRequest at from origin has been blocked by CORS policy: No ‘Access-Control-Allow-Or
No module named ‘corsheaders’

只需要pip3 install django-cors-headers
Access to XMLHttpRequest at from origin has been blocked by CORS policy: No ‘Access-Control-Allow-Or
这样就可以啦