问题描述 :
django页面js中发送ajax请求,结果报错,特此巨鹿。
Traceback (most recent call last):
File "F:\django_learn_project5\dailyfresh\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "F:\django_learn_project5\dailyfresh\venv\lib\site-packages\django\utils\deprecation.py", line 93, in __call__
response = self.process_request(request)
File "F:\django_learn_project5\dailyfresh\venv\lib\site-packages\django\middleware\common.py", line 53, in process_request
path = self.get_full_path_with_slash(request)
File "F:\django_learn_project5\dailyfresh\venv\lib\site-packages\django\middleware\common.py", line 93, in get_full_path_with_slash
'url': request.get_host() + new_path,
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/cart/a
dd/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
原因分析:
发送请求的url没有完整,结尾的[/]一定要有