Gunicorn - ValueError:不支持非阻塞套接字

问题描述 投票:0回答:0

我有一个具有实时聊天功能的 Python Flask 应用程序,我正试图将其托管在 Ubuntu 18.04 LTS 服务器上。我使用 Eventlet 来运行应用程序,并使用 Gunicorn 和 Nginx 来托管它。这是 run.py 的代码:

# Introduction: This file only runs the app

import eventlet
eventlet.monkey_patch()

from ifileshifts import app, socketio
from flask_debugtoolbar import DebugToolbarExtension

app.debug = False
DebugToolbarExtension(app)

if __name__ == '__main__':
    socketio.run(app, debug=False, host='0.0.0.0', port=5000, worker_class='gevent')

我尝试在服务器上托管时遇到错误。这是终端的错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/sync.py", line 182, in handle_request
    resp.write_file(respiter)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/http/wsgi.py", line 385, in write_file
    if not self.sendfile(respiter):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/http/wsgi.py", line 375, in sendfile
    self.sock.sendfile(respiter.filelike, count=nbytes)
  File "/usr/lib/python3.6/socket.py", line 399, in sendfile
    return self._sendfile_use_sendfile(file, offset, count)
  File "/usr/lib/python3.6/socket.py", line 279, in _sendfile_use_sendfile
    raise ValueError("non-blocking sockets are not supported")
ValueError: non-blocking sockets are not supported
python gunicorn gevent flask-socketio eventlet
© www.soinside.com 2019 - 2024. All rights reserved.