1. 跨域问题:

  pip install django-cors-headers

  在settings中配置:

     INSTALLED_APPS = [

          ...

          'corsheaders',

                  ]

    MIDDLEWARE_CLASSES = (

          ...  

                 'corsheaders.middleware.CorsMiddleware',

     'django.middleware.common.CommonMiddleware' #注意顺序

  )

最后加上 CORS_ORIGIN_ALLOW_ALL = True

posted on 2018-02-02 15:02  hello_xiaoyu  阅读(84)  评论(0编辑  收藏  举报