First, the cross-domain:
In simple terms: If the requested data to the front end of the back-end, front and rear ends of the ip and port are inconsistent, that is not under the Uniform Domain Name, there have been CORS cross-domain issues.
Second, the background processing across domains
Plug in the background environment django directory:
>: pip install django-cors-headers
插件参考地址:https://github.com/ottoyiu/django-cors-headers/
In django settings.py in the project configuration
# 注册app
INSTALLED_APPS = [
...
'corsheaders'
]
# 添加中间件
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware'
]
# 允许跨域源
CORS_ORIGIN_ALLOW_ALL = True