安装django-cors-headers
python -m pip install django-cors-headers
在#setting.py 下添加如下代码
INSTALLED_APPS = [ ..., "corsheaders", ..., ] MIDDLEWARE = [ ..., "corsheaders.middleware.CorsMiddleware", #尽量放在最上面 "django.middleware.common.CommonMiddleware", ..., ] ... CORS_ORIGIN_ALLOW_ALL = True # 新增这一句
标签:...,corsheaders,请求,middleware,django,cors,跨域
From: https://www.cnblogs.com/facenl/p/17123172.html