python不断刷新网页_flask 不停刷新页面,崩溃

博主在本地电脑安装Flask并搭建Web服务器,用浏览器不停刷新页面时Flask崩溃。给出了Flask示例代码,还展示了报错信息,最后对是否为bug提出疑问。
Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

我在本地电脑上安装了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

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?

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值