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/user/login/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Django 3.2.8 中,表单的action末尾若未加/ ,会报出上述错误。给出的解决方案👇
Change your form to point to 127.0.0.1:8000/user/login/ (note the trailing slash),
or set APPEND_SLASH=False in your Django settings
APPEND_SLASH 是起什么作用?(默认值是True) 在settings.py里,添加APPEND_SLASH = False ,则不再自动跳转。
把APPEND_SLASH = False 注释掉: 需用火狐浏览器。(谷歌浏览器似乎会在自动在url末尾加/ )
|