学习是一个逐步发现自己无知的过程!

RuntimeError: You called this URL via PUT

使用request方法 post 提交数据正常,发现同样的数据格式经过,提交PUT方法报错如下:

You called this URL via PUT, 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 PUT data. Change your form to point to 127.0.0.1:8000/Host/9/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.

视图函数的路由和请求路径不同意统一,请求路径少了个/符号 实际上报错也有提示是 URL的问题,所以容易误导

在URL结尾加上 / 即可解决

file

赞(0)
未经允许不得转载:劉大帥 » RuntimeError: You called this URL via PUT

你的评论可能会一针见血! 抢沙发

登录

找回密码

注册