[問題] django - csrf驗證失敗

作者: wahahahaaa (hah)   2020-03-28 15:23:50
最近參考此篇文章: https://ithelp.ithome.com.tw/articles/10202804 學django
出現以下錯誤: https://imgur.com/071onyE
*Your browser is accepting cookies. -> 已檢查 ok
*The view function passes a request to the template's render method.
*In the template, there is a {% csrf_token %} ... 參考文中作者所說 ok
*If you are not using CsrfViewMiddleware... 已檢查 ok
*The form has a valid CSRF token. After logging in....
作者: clang (llvm)   2020-03-28 16:29:00
HTML第8行那個不必要,它需要的token要放在form內,吃的是14行那個不過我不覺得這是錯誤的原因
作者: trew98741   2020-03-28 20:53:00
把 card移到extend後試試擺在你的 block content後一行對 csrf.
作者: yuenu   2020-03-30 00:17:00
那你的base.html是寫了什麼...
作者: wahahahaaa (hah)   2020-03-30 15:20:00
在檢查了兩次重打就好了 可能是檔案沒儲存到@@..

Links booklink

Contact Us: admin [ a t ] ucptt.com