django 跨域 Posted on 2017-09-24 | 用 django cors headers 解决跨域问题 Setup1pip install django-cors-headers 12345INSTALLED_APPS = ( ... 'corsheaders', ...) 1234567# 在 csrf 之前MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10 ... 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ...] Configuration12...CORS_ORIGIN_ALLOW_ALL = True 参考 django-cors-headers