[Twisted-web] Assync method on render_POST(self,request)
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Feb 16 07:54:38 EST 2012
On 12:26 pm, joaoricardo000 at gmail.com wrote:
>[snip]
>
>def doStuff(self,d,msg):
> # do some stuff
> time.sleep(2) #just for example
> d.callback('ok')
>
>[snip]
>So far, so good, but, the HTTP response (return 'done'), only happens
>after
>the delay (time.sleep(2)). I can tell this, because the browser keeps
>'loading' for 2 seconds.
>
>What am I doing wrong?
Answered on Stack Overflow:
http://stackoverflow.com/questions/9310350/twisted-non-blocking-method-
how-to
>Found some answer saying that wsgi twisted does not suport assync, and
>maybe Tornado could do this. ... is that true?
By definition, WSGI applications are not asynchronous. However, your
code is not a WSGI application, so the nature of WSGI applications is
irrelevant.
Tornado doesn't change these facts. WSGI for Tornado is the same as
WSGI for anything else.
Jean-Paul
More information about the Twisted-web
mailing list