问题描述——RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set. Django can’t redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/film/register/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Django项目使用postman测试post请求时候出现报错解决
问题描述——RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set. Django can’t redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/film/register/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
问题原因
错误分析:
因为定义的是post请求,pots请求一般是要携带参数进行提交,后面表单验证,但是测试没有写表单验证数据,只有一个post请,这个时候要给url地址末尾加上/,或者修改settings:APPEND_SLASH=False.
解决方法
post请求代码
view视图代码
解决post请求不成功方法:
RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
提示form的action地址最后不是/结尾的,而且APPEND_SLASH的值是Ture
将from的action地址改为/结尾的就可以了
或者
修改settings:APPEND_SLASH=False
问题解决
三、python算法篇(二)顺序表
顺序表的两种存储形式(1)基本顺序表(2)元素外围顺序表顺序表的 ==一体式结构== 与 ==分离式结构==顺序表的替换与扩充顺序表的插入与删除元素(1)插入删除其他知识点 python,大数据,机器学习,深度学习,计算机视觉
三、python算法篇(二)顺序
问题描述——RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set. Django can’t redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/film/register/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.