Separation of front and back interaction
Background processing across domains
Install plug
>: pip install django-cors-headers
插件参考地址:https://github.com/ottoyiu/django-cors-headers/
Project Configuration: dev.py
# 注册app
INSTALLED_APPS = [
...
'corsheaders'
]
# 添加中间件
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware'
]
# 允许跨域源
CORS_ORIGIN_ALLOW_ALL = True