Django在form提交CSRF验证失败. 相应中断问题
作者:互联网
CSRF验证失败. 相应中断.
1).首先,我们可以先看一下出现问题的所在的原因。
- Your browser is accepting cookies.
- The view function passes a
request
to the template'srender
method. - In the template, there is a
{% csrf_token %}
template tag inside each POST form that targets an internal URL. - If you are not using
CsrfViewMiddleware
, then you must usecsrf_protect
on any views that use thecsrf_token
template tag, as well as those that accept the POST data.
标签:render,csrf,form,RequestContext,Django,token,添加,template,CSRF 来源: https://blog.51cto.com/u_13583851/2873210