1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-12-12 11:18:05 +00:00

Fix for gevent as optional

This commit is contained in:
Jack Darlington
2017-03-16 21:02:49 +00:00
parent 06a4af44cc
commit b352bbfd14
2 changed files with 6 additions and 5 deletions

9
cps.py
View File

@@ -20,10 +20,11 @@ if __name__ == '__main__':
if web.ub.DEVELOPMENT:
web.app.run(host="0.0.0.0", port=web.ub.config.config_port, debug=True)
else:
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:
try:
web.app.logger.info('Attempting to start gevent')
web.start_gevent()
except ImportError:
web.app.logger.info('Falling back to Tornado')
http_server = HTTPServer(WSGIContainer(web.app))
http_server.listen(web.ub.config.config_port)
IOLoop.instance().start()