Django设置跨域
pip install django-cors-header
- MIDDLEWARE中添加到最前面
‘corsheaders.middleware.CorsMiddleware‘,
- APP中添加
‘corsheaders‘,
- 再
CORS_ORIGIN_ALLOW_ALL = True
pip install django-cors-header
‘corsheaders.middleware.CorsMiddleware‘,
‘corsheaders‘,
CORS_ORIGIN_ALLOW_ALL = True