CSRF verification failed. Request aborted. 表单提交方法为POST时的报错
本人所用Django版本为1.11,在设置请求方法为POST时,遇到标题中的错误,尝试了多种方法,最终通过下面的操作来修复:
在template文件中添加图中红框部分
接着,导入csrf_exempt,同时在方法前面添加装饰器
CSRF verification failed. Request aborted. 表单提交方法为POST时的报错的更多相关文章
- Django提交POST表单“CSRF verification failed. Request aborted”问题的解决
1.环境 python 3.4 Django 1.7 Visual Studio 2015 PTVS 2.问题 提交表单,出现以下错误: CSRF verification failed. Reque ...
- CSRF verification failed. Request aborted.
在使用Django提交Post表单时遇到如下错误: Forbidden (403) CSRF verification failed. Request aborted. 原因在"帮助&quo ...
- CSRF verification failed. Request aborted.错误解决办法
在Django项目的页面,提交form表单POST请求时,会出现报错:CSRF verification failed. Request aborted. 需要在form表单中加:{% csrf_to ...
- django csrf使用教程,解决Forbidden (403)CSRF verification failed. Request aborted.
Django版本号:1.11.15 django中post请求报错:Forbidden (403)CSRF verification failed. Request aborted. HelpReas ...
- django程序报错CSRF verification failed. Request aborted.
django程序的html页面中form的method='post'的时候报错 Forbidden (403) CSRF verification failed. Request aborted.He ...
- Django1.8:403错误:CSRF verification failed. Request aborted.
问题:Django 403错误:CSRF verification failed. Request aborted. 原因:需要加cookie验证 解决方法: 1.在view.py中增加 fr ...
- Django中关于“CSRF verification failed. Request aborted”的问题
遇到该问题的情境 在Django中采用Ajax提交表单,涉及到跨域问题. 解决措施 在html页面中的表单内添加如下代码: {% csrf_token %} 在视图函数所在的py文件中添加如下代码: ...
- django框架中form表单Post方法无法提交 Forbidden (403) CSRF verification failed. Request aborted.
问题如图: 解决方法: 在视图函数中引入并使用装饰器 from django.views.decorators.csrf import csrf_exempt @csrf_exempt
- Django 403错误:CSRF verification failed. Request aborted
网上有解决办法,我自己的组合是: 一,FORM加标识 <form action="" method="post"> {% csrf_token %} ...
随机推荐
- Typora练习测试
目录 一级标题 二级标题 三级标题 一级标题 二级标题 三级标题 这是下划线 删除线 字体加粗ctrl+b 这是倾斜线 1111 牛奶 面包 鸡蛋 包子 蛋糕 测试 牛奶 面包 鸡蛋 电脑 鼠标 键盘 ...
- hdu1232 畅通工程 基础并查集
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> ...
- spring MVC 文件上传错误
1.The request sent by the client was syntactically incorrect () http://luanxiyuan.iteye.com/blog/187 ...
- Educational Codeforces Round 20 A
Description You are given matrix with n rows and n columns filled with zeroes. You should put k ones ...
- javascript简单的表单验证
<html> <head> <title>用户登录</title> <script language="javascript" ...
- 记录两个python itchat的用法博客网址
http://www.tuicool.com/articles/VJZRRfn https://itchat.readthedocs.io/zh/latest/
- Git命令---递归克隆
git clone --recursive https://github.com/rbgirshick/fast-rcnn.git Git命令 --recursive 会递归克隆fast-rcnn项目 ...
- HDU 5778 abs 数学
http://acm.hdu.edu.cn/showproblem.php?pid=5778 这题的意思就是找离x最近的一个数y,且y是一个完全平方数,还是所有质因子都只能出现两次的完全平方数 一开始 ...
- Spring Boot学到的内容
Hello World:了解程序入口(创建启动类) Web程序:写Controller类(@RestController),写Controller方法(@GetMapping),maven依赖spri ...
- CF778A(round 402 div.2 D) String Game
题意: Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. B ...