Skip to content
This repository has been archived by the owner on Apr 9, 2019. It is now read-only.

Commit

Permalink
refine index.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Phus Lu committed Jan 1, 2014
1 parent 23a8a86 commit 0ca7c46
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions server/php/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,19 @@ def application(environ, start_response):


def run_wsgi_app(address, app):
from gunicorn.app.wsgiapp import WSGIApplication
class GunicornApplication(WSGIApplication):
def init(self, parser, opts, args):
return {'bind': '%s:%d' % (address[0], int(address[1])),
'workers': 2,
'worker_class': 'gevent'}
def load(self):
return application
GunicornApplication().run()
try:
from gunicorn.app.wsgiapp import WSGIApplication
class GunicornApplication(WSGIApplication):
def init(self, parser, opts, args):
return {'bind': '%s:%d' % (address[0], int(address[1])),
'workers': 2,
'worker_class': 'gevent'}
def load(self):
return application
GunicornApplication().run()
except ImportError:
from gevent.wsgi import WSGIServer
WSGIServer(address, app).serve_forever()


if __name__ == '__main__':
Expand Down

0 comments on commit 0ca7c46

Please sign in to comment.