mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Assume non-web.Application instances are WSGI.
This commit is contained in:
parent
999dd68ca3
commit
22695ff248
@ -9,6 +9,7 @@ import sys
|
||||
import tornado.web
|
||||
from tornado.httpserver import HTTPServer
|
||||
from tornado.ioloop import IOLoop, PeriodicCallback
|
||||
from tornado.wsgi import WSGIContainer
|
||||
|
||||
|
||||
from gunicorn.workers.base import Worker
|
||||
@ -46,6 +47,11 @@ class TornadoWorker(Worker):
|
||||
self.ioloop = IOLoop.instance()
|
||||
PeriodicCallback(self.watchdog, 1000, io_loop=self.ioloop).start()
|
||||
|
||||
# Assume the app is a WSGI callable if its not an
|
||||
# instance of tornardo.web.Application
|
||||
if not isinstance(self.app, tornado.web.Application):
|
||||
self.app = WSGIContainer(self.app)
|
||||
|
||||
server = HTTPServer(self.app, io_loop=self.ioloop)
|
||||
server._socket = self.socket
|
||||
server.start(num_processes=1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user