栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

RuntimeError: You called this URL via POST, but the URL doesn‘t end in a slash and you have APPEND

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

RuntimeError: You called this URL via POST, but the URL doesn‘t end in a slash and you have APPEND

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 re
direct to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/carts/user/cart/ (note the t
railing slash), or set APPEND_SLASH=False in your Django settings.

翻译后:

RuntimeError:您通过POST调用了这个URL,但是URL不是以斜杠结尾,并且您设置了append_斜杠。Django不能重新

在维护POST数据时直接指向斜杠URL。将表单更改为127.0.0.1:8000/购物车/user/cart/(注意t

或者在Django设置中设置APPEND_SLASH=False。

1.代码运行 时碰到这样的错误

从翻译来看实url地址错误

我自己这样解决的把自己路由的地址最后一个 ‘/’ 去掉就好了

2.网上还有另一种方法(没试过)

或者修改settings:APPEND_SLASH=False.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1030766.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号