我可以同时使用 Twisted 和 mod_wsgi 来尝试提高性能吗?
由于我没有启动reactor.listenTCP(...),我该如何使用twisted的异步方法?:
我试过的:
> server.wsgi
def application(environ, start_response):
status = '200 OK'
output = 'Pong!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
# How do I call a twisted async method from here?!
# like deferToThread(object.send, environ).
return [output]
resource = WSGIResource(reactor, reactor.getThreadPool(), application)