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

optim 发布于 2019/05/01 17:44
阅读 450
收藏 0

----------------------------------------
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]
----------------------------------------
 

加载中
0
optim
optim

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

0
optim
optim
@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

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部