django项目在发送请求时,后端报错
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/users/get_body/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.

解决方法
提示的时url地址不是以/结尾的,把请求的url最后加上/就可以了
也可以去setting配置文件中添加一项配置:APPEND_SLASH=False

本文详细解析了Django框架中因URL未以斜杠结尾导致的RuntimeError异常,提供了两种解决方案:一是调整URL使其以斜杠结尾;二是修改settings配置文件中的APPEND_SLASH选项为False。这将帮助开发者避免因URL配置不当引发的运行时错误。
1111

被折叠的 条评论
为什么被折叠?



