安装django-cors-headers模块
pip install django-cors-headers
在settings.py中配置
INSTALLED_APPS = [
...
'corsheaders',
...
]
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware',
...
]
# 允许跨域源
CORS_ORIGIN_ALLOW_ALL = True
标签:...,corsheaders,跨域,项目,django,headers,cors From: https://www.cnblogs.com/sunhouzi/p/17731773.html