django_類視圖bug

RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

使用postman 測試Django 類視圖的 post 方法時遇到如下bug:

RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set.

postman 輸入訪問截圖:

解決辦法:

原來postman的 url 地址少輸入了一個 ’/‘,輸入

127.0.0.1:8000/viewclass/index/

bug 自動消除,因爲post 不會在url末尾自動補充’/‘。瀏覽器會自動補充。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章