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末尾自动补充’/‘。浏览器会自动补充。