drf解决跨域问题 使用 django-corse-headers扩展
生活随笔
收集整理的这篇文章主要介绍了
drf解决跨域问题 使用 django-corse-headers扩展
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
跨域CORS
使用django-corse-headers扩展
安装
pip install django-cors-headers添加应用
INSTALLED_APPS = (...'corsheaders',... )中间层设置
MIDDLEWARE = ['corsheaders.middleware.CorsMiddleware',... ]添加白名单
# CORS CORS_ORIGIN_WHITELIST = ('127.0.0.1:8080','localhost:8080', ) CORS_ALLOW_CREDENTIALS = True # 允许携带cookie转载于:https://www.cnblogs.com/a-way-blog/p/9847692.html
总结
以上是生活随笔为你收集整理的drf解决跨域问题 使用 django-corse-headers扩展的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: JZOJ5922. 【NOIP2018模
- 下一篇: 小程序自定义组件