Django设置跨域

pip install django-cors-header

  • MIDDLEWARE中添加到最前面 
    ‘corsheaders.middleware.CorsMiddleware‘,
  • APP中添加
    ‘corsheaders‘,
  • CORS_ORIGIN_ALLOW_ALL = True
 

相关推荐