Django 报错,跨域请求出现问题。

在settings.py中添加

Access to XMLHttpRequest at 'http://127.0.0.1:8000/XXXXX' from origin 'http://localhost

#设置可跨域范围

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
Access to XMLHttpRequest at 'http://127.0.0.1:8000/XXXXX' from origin 'http://localhost
#定义跨域中间件
'corsheaders.middleware.CorsMiddleware',
 

相关文章:

  • 2021-06-18
  • 2021-12-03
  • 2022-01-02
  • 2022-01-12
  • 2021-12-13
  • 2022-12-23
  • 2021-04-20
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2021-11-02
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
相关资源
相似解决方案