1

Ubuntu OS の Gunicorn で実行する SocketIO サーバーを実行してみました。

gevent
gevent-socketio
gunicorn

run.py

from views import app
from gevent import monkey
from socketio.server import SocketIOServer
import werkzeug.serving

monkey.patch_all()
PORT = 5000

@werkzeug.serving.run_with_reloader
def runServer()
    print 'Listening on http://127.0.0.1:%s and on port 10843 (flash policy server)' % PORT
    SocketIOServer(('', PORT), app, resource="socket.io").serve_forever()

if __name__ == '__main__':
    runServer()

使用したコマンド -

gunicorn --worker-class socketio.sgunicorn.GeventSocketIOWorker run:app

接続が切断され、頻繁に再接続されているように見える -

2013-12-24 22:40:59 [3331] [INFO] Starting gunicorn 0.13.4
2013-12-24 22:40:59 [3331] [INFO] Listening at: http://127.0.0.1:8000 (3331)
2013-12-24 22:40:59 [3331] [INFO] Using worker: socketio.sgunicorn.GeventSocketIOWorker
2013-12-24 22:40:59 [3334] [INFO] Booting worker with pid: 3334
2013-12-24 22:41:01 [3339] [INFO] Starting gunicorn 0.13.4
2013-12-24 22:41:01 [3339] [ERROR] Connection in use: ('127.0.0.1', 8000)
2013-12-24 22:41:01 [3339] [ERROR] Retrying in 1 second.
2013-12-24 22:41:02 [3339] [ERROR] Connection in use: ('127.0.0.1', 8000)
2013-12-24 22:41:02 [3339] [ERROR] Retrying in 1 second.
2013-12-24 22:41:03 [3339] [ERROR] Connection in use: ('127.0.0.1', 8000)
2013-12-24 22:41:03 [3339] [ERROR] Retrying in 1 second.
2013-12-24 22:41:04 [3339] [ERROR] Connection in use: ('127.0.0.1', 8000)
2013-12-24 22:41:04 [3339] [ERROR] Retrying in 1 second.
4

1 に答える 1

0

この行 @werkzeug.serving.run_with_reloader にコメントを付けると、うまくいくはずです。

于 2014-05-18T22:37:24.733 に答える