From 4b59eab3eb1c1d7817b15b850f97646d186f259b Mon Sep 17 00:00:00 2001 From: Jack Darlington Date: Tue, 7 Mar 2017 22:38:23 +0000 Subject: [PATCH] =?UTF-8?q?Updated=20to=20use=20=E2=80=9Cgevent=E2=80=9D?= =?UTF-8?q?=20so=20can=20use=20yield=20to=20download=20books?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cps.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cps.py b/cps.py index ed939c37..361b2e0f 100755 --- a/cps.py +++ b/cps.py @@ -14,14 +14,19 @@ from cps import web from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop +from gevent.wsgi import WSGIServer if __name__ == '__main__': if web.ub.DEVELOPMENT: web.app.run(host="0.0.0.0", port=web.ub.config.config_port, debug=True) else: - http_server = HTTPServer(WSGIContainer(web.app)) - http_server.listen(web.ub.config.config_port) - IOLoop.instance().start() + if len(sys.argv) > 1 and sys.argv[1] == '-g': + http_server = WSGIServer(('', web.ub.config.config_port), web.app) + http_server.serve_forever() + else: + http_server = HTTPServer(WSGIContainer(web.app)) + http_server.listen(web.ub.config.config_port) + IOLoop.instance().start() if web.helper.global_task == 0: web.app.logger.info("Performing restart of Calibre-web")