简体   繁体   中英

csrf_token problem django

I have put in the {% csrf_token %} and the context_instance=RequestContext(request)) but I still get the error CSRF token missing or incorrect . Thanks in advance! or not.

Make sure the CSRF token template variable is inside your form. If you're sure it is, view the page's HTML source to make sure that it's actually printing out the hidden input field. If all else fails, check your settings to make sure the CSRF middleware is enabled and configured properly.

Additionally, having the source (or at least a few lines of context) would be greatly helpful in figuring out your problem.

You append {% csrf_token %} to the form ? (<form>{% csrf_token %} ...</form>)

在您的 HTML 表单中使用 {% csrf_token %} 验证作为下面的示例。

<form> {% csrf_token %} </form>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM