>: pip install django-cors-headers
插件参考地址:https://github.com/ottoyiu/django-cors-headers/
# 注册app
INSTALLED_APPS = [
...
'corsheaders'
]
# 添加中间件
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware'
]
# 允许跨域源
CORS_ORIGIN_ALLOW_ALL = True原文:https://www.cnblogs.com/XuChengNotes/p/11871474.html