• 欢迎访问笔记阁,实用快捷文章教程,推荐使用Chrome浏览器和360极速浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏笔记阁吧

360极速浏览器访问Flask站点时报错

运维干货 feko 1个月前 (03-08) 26次浏览 已收录 0个评论 扫描二维码
  • 问题:用360极速浏览器访问Flask站点时报以下错误,google浏览器访问正常
cat >Hello_production.py << EOF
from flask import Flask
from wsgiref.simple_server import make_server

app = Flask(__name__)

@app.route('/')
def hello_world():
    return "hello"
@app.route('/web')
def hello_world2():
    return "hello web"
if __name__ == '__main__':
    server = make_server('0.0.0.0', 5000, app)
    server.serve_forever()
EOF
# 
# python3 Hello_production.py
Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 332, in send_headers
    self.send_preamble()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 252, in send_preamble
    self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1'))
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib64/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
192.168.209.1 - - [08/Mar/2021 17:15:02] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('192.168.209.1', 52933)
Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 332, in send_headers
    self.send_preamble()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 252, in send_preamble
    self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1'))
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib64/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 344, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python3.6/socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python3.6/socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python3.6/socketserver.py", line 724, in __init__
    self.handle()
  File "/usr/lib64/python3.6/wsgiref/simple_server.py", line 133, in handle
    handler.run(self.server.get_app())
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/usr/lib64/python3.6/wsgiref/simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
  • 解决
    将360极速浏览器设置为极速模式即可。

笔记阁 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:360极速浏览器访问Flask站点时报错
喜欢 (0)
发表我的评论
取消评论
表情 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址