Django之使用postman测试工具测试POST请求时,出现RuntimeError错误信息

问题点:

使用postman时,测试POST请求时,出现`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/get_form_data/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings


使用postman时,测试POST请求时,出现`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/get_form_data/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings`

测试工具postman 如图所示:

Django之使用postman测试工具测试POST请求时,出现RuntimeError错误信息_第1张图片

问题解决方案:

在POST发送127.0.0.1:8000/get_form_data 修改成127.0.0.1:8000/get_form_data/ 就可以执行成功,get请求后面可以不加 /,但post请求后面一定要加 / ,再刷新就可以正常执行了

Django之使用postman测试工具测试POST请求时,出现RuntimeError错误信息_第2张图片

你可能感兴趣的:(Python)