1
我可以一起使用Twisted和mod_wsgi來嘗試性能上的增益嗎?Twisted上使用WSGI
由於我不是開始reactor.listenTCP(...),我該如何使用的扭曲的異步方法?:
我曾嘗試:
> 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)