开发者社区> 问答> 正文

flask普通请求正常,ajax请求报错?报错

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 65531)
Traceback (most recent call last):
  File "D:\python2.7\Lib\SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "D:\python2.7\Lib\SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "D:\python2.7\Lib\SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "D:\python2.7\Lib\SocketServer.py", line 654, in __init__
    self.finish()
  File "D:\python2.7\Lib\SocketServer.py", line 713, in finish
    self.wfile.close()
  File "D:\python2.7\Lib\socket.py", line 283, in close
    self.flush()
  File "D:\python2.7\Lib\socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053]
----------------------------------------
 

展开
收起
爱吃鱼的程序员 2020-06-06 09:25:56 424 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>在网上查询[Errno 10053]最终得出结果是 被程序中断了socket,最终解决查看前端是在ajax请求时提前中断了请求最后删除中断代码,程序恢复正常</p>
                    
    
                        <pre>
    

    @admin.route("/role/add",methods=["GET","POST"]) def role_add(): if request.method == "GET": role_form = roleForm() return render_template("admin/default/role/admin-role-add.html",form=role_form) if request.method == "POST": name = request.form.get("name") remarks = request.form.get("remarks") print(name) print(remarks) return jsonify({"msg":"添加失败","status":200})

    这个是请求代码,可以打印出name、remarks

    2020-06-06 09:26:14
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载