Commit b91e4e41 authored by wanli's avatar wanli

update

parent a841cc68
......@@ -23,26 +23,26 @@ def run():
生产模式启动命令函数
To use: python3 manager.py run
"""
app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
service_config = {
'bind': app.config.get('BIND', '0.0.0.0:3000'),
'workers': app.config.get('WORKERS', cpu_count() * 2 + 1),
'worker_class': 'gevent',
'worker_connections': app.config.get('WORKER_CONNECTIONS', 10000),
'backlog': app.config.get('BACKLOG', 2048),
'timeout': app.config.get('TIMEOUT', 60),
'loglevel': app.config.get('LOG_LEVEL', 'info'),
'pidfile': app.config.get('PID_FILE', 'run.pid'),
}
# app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
# service_config = {
# 'bind': app.config.get('BIND', '0.0.0.0:3000'),
# 'workers': app.config.get('WORKERS', cpu_count() * 2 + 1),
# 'worker_class': 'gevent',
# 'worker_connections': app.config.get('WORKER_CONNECTIONS', 10000),
# 'backlog': app.config.get('BACKLOG', 2048),
# 'timeout': app.config.get('TIMEOUT', 60),
# 'loglevel': app.config.get('LOG_LEVEL', 'info'),
# 'pidfile': app.config.get('PID_FILE', 'run.pid'),
# }
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(3000)
http_server.listen(3000, address='127.0.0.1')
# wsgi_app = WSGIContainer(app)
# application = Application([
# (r'.*', FallbackHandler, dict(fallback=wsgi_app))
# ], **service_config)
# application.listen(3000, address='127.0.0.1')
# application.listen(3000)
IOLoop.instance().start()
......
......@@ -28,12 +28,12 @@ def pushmessage(func):
try:
if isinstance(msg, WebsocketResponse) or isinstance(msg, dict):
self.write_message(json.dumps(msg), binary)
elif isinstance(msg, str) or isinstance(msg, unicode):
elif isinstance(msg, str) or isinstance(msg, str):
self.write_message(msg, binary)
else:
self.write_message(repr(msg), binary)
except WebSocketClosedError as e:
logger.error(e)
self.on_close()
return send
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment