背景知识: 跨域相关与cors策略

1.安装django-cors-headers

pip install django-cors-headers

2.settings.py配置

INSTALLED_APPS = [
    ......
    'corsheaders',
    ......
]

MIDDLEWARE = [
    ......
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    ......
]

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True

 

相关文章:

  • 2021-11-22
  • 2022-02-03
  • 2021-05-25
  • 2022-02-08
  • 2022-12-23
  • 2022-01-07
  • 2022-01-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2021-07-26
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案