Access to XMLHttpRequest at 'http://127.0.0.1:8000/XXXXX' from origin 'http://localhost
Django 报错,跨域请求出现问题。
在settings.py中添加
#设置可跨域范围
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
![](https://img2018.cnblogs.com/blog/1566618/201905/1566618-20190503224507005-537236893.png)
#定义跨域中间件
'corsheaders.middleware.CorsMiddleware',