本人所用Django版本为1.11,在设置请求方法为POST时,遇到标题中的错误,尝试了多种方法,最终通过下面的操作来修复:

在template文件中添加图中红框部分

接着,导入csrf_exempt,同时在方法前面添加装饰器

CSRF verification failed. Request aborted. 表单提交方法为POST时的报错的更多相关文章

  1. Django提交POST表单“CSRF verification failed. Request aborted”问题的解决

    1.环境 python 3.4 Django 1.7 Visual Studio 2015 PTVS 2.问题 提交表单,出现以下错误: CSRF verification failed. Reque ...

  2. CSRF verification failed. Request aborted.

    在使用Django提交Post表单时遇到如下错误: Forbidden (403) CSRF verification failed. Request aborted. 原因在"帮助&quo ...

  3. CSRF verification failed. Request aborted.错误解决办法

    在Django项目的页面,提交form表单POST请求时,会出现报错:CSRF verification failed. Request aborted. 需要在form表单中加:{% csrf_to ...

  4. django csrf使用教程,解决Forbidden (403)CSRF verification failed. Request aborted.

    Django版本号:1.11.15 django中post请求报错:Forbidden (403)CSRF verification failed. Request aborted. HelpReas ...

  5. django程序报错CSRF verification failed. Request aborted.

    django程序的html页面中form的method='post'的时候报错 Forbidden (403) CSRF verification failed. Request aborted.He ...

  6. Django1.8:403错误:CSRF verification failed. Request aborted.

    问题:Django 403错误:CSRF verification failed. Request aborted.     原因:需要加cookie验证 解决方法: 1.在view.py中增加 fr ...

  7. Django中关于“CSRF verification failed. Request aborted”的问题

    遇到该问题的情境 在Django中采用Ajax提交表单,涉及到跨域问题. 解决措施 在html页面中的表单内添加如下代码: {% csrf_token %} 在视图函数所在的py文件中添加如下代码: ...

  8. django框架中form表单Post方法无法提交 Forbidden (403) CSRF verification failed. Request aborted.

    问题如图: 解决方法: 在视图函数中引入并使用装饰器 from django.views.decorators.csrf import csrf_exempt @csrf_exempt

  9. Django 403错误:CSRF verification failed. Request aborted

    网上有解决办法,我自己的组合是: 一,FORM加标识 <form action="" method="post"> {% csrf_token %} ...

随机推荐

  1. 树的直径初探+Luogu P3629 [APIO2010]巡逻【树的直径】By cellur925

    题目传送门 我们先来介绍一个概念:树的直径. 树的直径:树中最远的两个节点间的距离.(树的最长链)树的直径有两种方法,都是$O(N)$. 第一种:两遍bfs/dfs(这里写的是两遍bfs) 从任意一个 ...

  2. 如何访问google?

    1:浏览器打开 uzer.me 网站(建议:火狐,不行就谷歌) 2:点击注册,注册一个账号 3:登录账号,进入如下界面,选择火狐浏览器 4:这样就可以进行国外的网站访问了

  3. PyQt5编程入门

    1  25行的弹出式闹钟 import sys import time from PyQt5 import QtCore from PyQt5.QtWidgets import QLabel from ...

  4. Educational Codeforces Round 24 E

    Vova again tries to play some computer card game. The rules of deck creation in this game are simple ...

  5. sendRedirect和forward区别

    参考来源:http://www.educity.cn/develop/158970.html 12.6.4  sendRedirect()和forward()方法的区别 HttpServletResp ...

  6. 转 Oracle中merge into的使用

    http://www.cnblogs.com/highriver/archive/2011/08/02/2125043.html

  7. Jquery 中使用String.Format

    第一种方法: String.format = function() { if (arguments.length == 0) return null; var str = arguments[0]; ...

  8. 小程序java解密

    <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk16< ...

  9. VUE学习——vue的内部指令学习(趁自己没忘,学习记录一下)

    1.v-if&v-else&v-show v-if用来判断是否加载html的DOM,v-if和v-else一般是一起用的. v-show相当于display,DOM已经加载出来了,这个 ...

  10. bat判断服务是否启动

    sc query|find "tomcat6" && echo yes || echo nosc query|find "eventlog" & ...