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.