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末尾自動補充’/‘。瀏覽器會自動補充。