python报错You called this URL via POST

 之前写python用到form表单时一切正常,今天忽然爆了一个摸不着头脑的错误。错误信息详情如下

RuntimeError at /details
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/details/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Request Method:	POST
Request URL:	http://127.0.0.1:8000/details
Django Version:	2.0.1
Exception Type:	RuntimeError
Exception Value:	
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/details/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Exception Location:	D:\untitled5\venv\lib\site-packages\django\middleware\common.py in get_full_path_with_slash, line 99
Python Executable:	D:\untitled5\venv\Scripts\python.exe
Python Version:	3.6.3
Python Path:	
['D:\\untitled5',
 'D:\\untitled5',
 'D:\\untitled5\\venv\\Scripts\\python36.zip',
 'C:\\ProgramData\\Anaconda3\\DLLs',
 'C:\\ProgramData\\Anaconda3\\lib',
 'C:\\ProgramData\\Anaconda3',
 'D:\\untitled5\\venv',
 'D:\\untitled5\\venv\\lib\\site-packages',
 'D:\\untitled5\\venv\\lib\\site-packages\\setuptools-28.8.0-py3.6.egg',
 'D:\\untitled5\\venv\\lib\\site-packages\\pip-9.0.1-py3.6.egg',
 'C:\\Program Files\\JetBrains\\PyCharm '
 '2017.3\\helpers\\pycharm_matplotlib_backend']
Server time:	Wed, 17 Jan 2018 03:45:18 +0000
经过多次查证,发现是form表单提交的action没有以‘/’结尾,添加上即可

  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值