其他分享
首页 > 其他分享> > django 跨域访问

django 跨域访问

作者:互联网

1.安装
pip install django-cors-headers

2.修改settings.py
INSTALLED_APPS = [
    ......
    'corsheaders',
    ......
]

MIDDLEWARE = [
    ......
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    ......
]

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
 

标签:corsheaders,跨域,......,django,访问,ALLOW,CORS,True
来源: https://www.cnblogs.com/rabitvision/p/15356594.html