diff options
author | Iuri de Silvio <iurisilvio@gmail.com> | 2011-09-17 12:12:55 -0300 |
---|---|---|
committer | Iuri de Silvio <iurisilvio@gmail.com> | 2011-09-17 12:12:55 -0300 |
commit | 664894634dccfef549a2f83e7dd5e40bacbb35f6 (patch) | |
tree | 4e476c802eb5baa6486aa041320363ad4fa2a601 | |
parent | 83523de755f9c428cb6a6944693ea0d8fd5d580e (diff) | |
download | bottle-664894634dccfef549a2f83e7dd5e40bacbb35f6.tar.gz |
Update GunicornServer, based on Itty implementation.
-rwxr-xr-x | bottle.py | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -2074,11 +2074,27 @@ class GeventServer(ServerAdapter): class GunicornServer(ServerAdapter): """ Untested. """ def run(self, handler): - from gunicorn.arbiter import Arbiter - from gunicorn.config import Config - handler.cfg = Config({'bind': "%s:%d" % (self.host, self.port), 'workers': 4}) - arbiter = Arbiter(handler) - arbiter.run() + from gunicorn import version_info + + config = {'bind': "%s:%d" % (self.host, int(self.port)), 'workers': 4} + + if version_info < (0, 9, 0): + from gunicorn.arbiter import Arbiter + from gunicorn.config import Config + + arbiter = Arbiter(Config(config), app()) + arbiter.run() + else: + from gunicorn.app.base import Application + + class GunicornApplication(Application): + def init(_self, parser, opts, args): + return config + + def load(self): + return app() + + GunicornApplication().run() class EventletServer(ServerAdapter): |