看板 Python 關於我們 聯絡資訊
各位好,我正照著書上的步驟學習django 想做一個表單,採用POST方法,但一直卡在403 forbidden 我有照著document給的建議了,加了{% csrf_token %}和RequestContext 結果還是一樣403 forbidden 想請教各位該怎麼改才好? 謝謝^^ 下面是template code http://imgur.com/a/dHj12 而這個是我的view code http://imgur.com/a/h7PI9 這是setting的middleware,裡面有設middleware.csrf.CsrfViewMiddleware了 http://imgur.com/a/E4OYj -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.44.75.197 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1476363495.A.2B9.html
kevinkung: Settings有加嗎? 10/13 21:38
gbllggi: MIDDLEWARE_CLASSES??? 10/13 22:43
kevinkung: 'django.middleware.csrf.CsrfViewMiddleware' 10/14 10:32
kevinkung: 你的'content'寫在哪裡?在template裡面沒看到!! 10/14 14:18
感謝糾正!不過我改成content之後,一樣403 forbidden.... ※ 編輯: vanchy (114.44.76.32), 10/14/2016 20:28:04
zaetheo: render_to_response()的指令好像在1.10版後使用就會有這 11/02 01:43
zaetheo: 個問題,可以改成用response()指令,我也在這個問題卡好 11/02 01:43
zaetheo: 久 11/02 01:43
zaetheo: 更正,是render() 11/02 01:47
zaetheo: ortcuts/ 11/02 01:48