Phase IV: Vue frame day75 Vue - Vue separated cross-domain interaction front and rear ends

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

Guess you like

Origin www.cnblogs.com/foreversun92/p/11869001.html