开发者社区> 问答> 正文

flask 不停刷新页面,崩溃?报错

我在本地电脑上安装了flask,并且用例子建了一个web服务器,一切正常

我开始玩了,我用浏览器按住F5不停的刷新页面时,flask就崩溃了。

例子:

from flask import Flask
app = Flask(__name__) 
@app.route("/")
def hello():
    return "Hello World!" if __name__ == "__main__":
    app.run()


报错:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    app.run()
  File "D:\Program Files\Python27\lib\site-packages\flask\app.py", line 843, in
run
    run_simple(host, port, self, **options)
  File "D:\Program Files\Python27\lib\site-packages\werkzeug\serving.py", line 6
94, in run_simple
    inner()
  File "D:\Program Files\Python27\lib\site-packages\werkzeug\serving.py", line 6
59, in inner
    srv.serve_forever()
  File "D:\Program Files\Python27\lib\site-packages\werkzeug\serving.py", line 4
99, in serve_forever
    HTTPServer.serve_forever(self)
  File "D:\Program Files\Python27\lib\SocketServer.py", line 238, in serve_forev
er
    self._handle_request_noblock()
  File "D:\Program Files\Python27\lib\SocketServer.py", line 297, in _handle_req
uest_noblock
    self.handle_error(request, client_address)
  File "D:\Program Files\Python27\lib\SocketServer.py", line 295, in _handle_req
uest_noblock
    self.process_request(request, client_address)
  File "D:\Program Files\Python27\lib\SocketServer.py", line 321, in process_req
uest
    self.finish_request(request, client_address)
  File "D:\Program Files\Python27\lib\SocketServer.py", line 334, in finish_requ
est
    self.RequestHandlerClass(request, client_address, self)
  File "D:\Program Files\Python27\lib\SocketServer.py", line 657, in __init__
    self.finish()
  File "D:\Program Files\Python27\lib\SocketServer.py", line 716, in finish
    self.wfile.close()
  File "D:\Program Files\Python27\lib\socket.py", line 283, in close
    self.flush()
  File "D:\Program Files\Python27\lib\socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
socket.error: [Errno 10053]

难道这是bug?


展开
收起
爱吃鱼的程序员 2020-06-09 13:05:35 744 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    我在本地电脑上安装了flask,并且用例子建了一个web服务器,一切正常

    我开始玩了,我用浏览器按住F5不停的刷新页面时,flask就崩溃了。求解答

    2020-06-09 13:09:49
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

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