开发者社区 问答 正文

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

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

----------------------------------------
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-05-31 00:43:27 618 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    在网上查询[Errno 10053]最终得出结果是 被程序中断了socket,最终解决查看前端是在ajax请求时提前中断了请求最后删除中断代码,程序恢复正常

    ######
    @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-05-31 00:43:28
    赞同 展开评论