>: 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/cheng825/p/11972842.html