Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add gevent support and avoid collision on logging module

  • Loading branch information...
commit b9d93f4e6b8777634be01beda6718a348b225a22 1 parent 4e29912
@amol- amol- authored
View
14 gearbox/commands/serve.py
@@ -21,7 +21,7 @@
import traceback
import platform
-from gearbox.utils.logging import setup_logging
+from gearbox.utils.log import setup_logging
from paste.deploy import loadapp, loadserver
from cliff.command import Command
@@ -842,6 +842,18 @@ def wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover
print('Starting HTTP server on http://%s:%s' % (host, port))
server.serve_forever()
+# For paste.deploy server instantiation (egg:gearbox#gevent)
+def gevent_server_runner(wsgi_app, global_config, **kw):
+ from gevent import reinit
+ from gevent.wsgi import WSGIServer
+ from gevent.monkey import patch_all
+ host = kw.get('host', '0.0.0.0')
+ port = int(kw.get('port', 8080))
+ reinit()
+ patch_all(dns=False)
+ print('Starting Gevent HTTP server on http://%s:%s' % (host, port))
+ WSGIServer((host, port), wsgi_app).serve_forever()
+
# For paste.deploy server instantiation (egg:gearbox#cherrypy)
def cherrypy_server_runner(
app, global_conf=None, host='127.0.0.1', port=None,
View
0  gearbox/utils/logging.py → gearbox/utils/log.py
File renamed without changes
View
3  setup.py
@@ -37,6 +37,7 @@
],
'paste.server_runner': [
'wsgiref = gearbox.commands.serve:wsgiref_server_runner',
- 'cherrypy = gearbox.commands.serve:cherrypy_server_runner'
+ 'cherrypy = gearbox.commands.serve:cherrypy_server_runner',
+ 'gevent = gearbox.commands.serve:gevent_server_runner'
]
})
Please sign in to comment.
Something went wrong with that request. Please try again.