django+Python的项目中出现 "detail": "CSRF Failed: CSRF cookie not set."
来源:互联网 发布:永琪干了知画 编辑:程序博客网 时间:2024/06/02 02:14
解决办法:(对django整体项目的目录要了解)
在自己的app下找一个.py(我在app目录下新建一个test.py)文件, 写入:
class DisableCSRF(object):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
在项目整体的setting.py中的
MIDDLEWARE_CLASSES = ('app.tests.DisableCSRF',)
加入即可。(注意逗号)
阅读全文
0 0
- django+Python的项目中出现 "detail": "CSRF Failed: CSRF cookie not set."
- 关于python 的django-forbidden-csrf-cookie-not-set问题
- python django-forbidden-csrf-cookie-not-set问题
- django错误 - Reason given for failure: CSRF cookie not set.
- django错误 - Reason given for failure: CSRF cookie not set.
- Django csrf cooie is not set
- django种表单post出现CSRF verification failed( CSRF验证失败 ) 的两种解决方案
- Django:CSRF verification failed.
- Django app接口url报错Forbidden (CSRF cookie not set.)
- Django 用postman进行post请求时:Forbidden (CSRF cookie not set.) 403
- python 使用django post提交时出现 CSRF verification failed. Request aborted.
- Python Django Forbidden (403) CSRF verification failed. Request aborted.
- python-Django Forbidden (403) CSRF verification failed. Request aborted.
- Django-CSRF的理解
- django中CSRF的问题及解决
- 关于Django中Csrf问题的解决方法
- django中404错误CSRF verification failed. Request aborted
- 解决django开发中CSRF verification failed. Request aborted.的问题
- 【贪心】BZOJ3668 [Noi2014]起床困难综合症
- Gensim官方介绍翻译
- Iterative Quantization
- 前言
- 逻辑英语-写作
- django+Python的项目中出现 "detail": "CSRF Failed: CSRF cookie not set."
- Gensim官方教程翻译——快速入门
- 提高深度学习性能的四种方式
- nginx 配置转发到其他多台服务器
- 2017年工作总结
- Linux应用编程
- TensorFlow基本操作(二)
- jdk1.8对HashMap的优化
- Hadoop的调度器总结