看到的地址:http://www.codeif.com/post/914/
tornado出現’_xsrf’ argument missing from POST問題解決
在使用tornado框架進行web開發的時候,post提交數據出現 '_xsrf' argument missing from POST錯誤,頁面提示403: Forbidden
出現原因:
在我們的setting中設置了:
xsrf_cookies=True
解決方案一:
xsrf_cookies=True
改為
xsrf_cookies=False
解決方案二: 提交的表單中加上: _xsrf ,可以使用內置函數xsrf_form_html() 來幫我們完成
如下:
<form action="/new_message" method="post">
<input type="text" name="message"/>
<input type="submit" value="Post"/>
</form>
參考文章:
http://sebug.net/paper/books/tornado/
http://stackoverflow.com/questions/12890105/tornado-xsrf-argument-missing-from-post