[Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

L. Daniel Burr ldanielburr at me.com
Tue Sep 20 12:21:57 EDT 2011

Hi Fabian,

On Tue, 20 Sep 2011 06:38:00 -0500, Fabian Rothfuchs  
<fabian.rothfuchs at googlemail.com> wrote:

> As Twisted points out not to be thread-safe, why would it be in WSGI?
> Due to the sensibility of the project I cannot afford things to go wrong
> because of not synchronized threads or other pitfalls, so I actually
> decided
> to to the asynchronous way, and this bites with WSGI.
> Fabian

Sorry for any confusion, but I never said anything about using twisted as  
a WSGI container for purposes of ensuring thread-safety.  I was only  
responding to your question about "how to wrap Django in twisted", and  
running Django inside twisted's WSGI container is one way to do that.

As you've already noted, the WSGI model doesn't take async frameworks like  
twisted into account.  This was a deliberate decision by the author of the  
spec, who originally said something to the effect that an async WSGI model  
would end up looking like twisted anyway.

If you can afford to make the change, running twisted as a completely  
separate service in another process, and implementing communication  
between your Django server and your twisted server via a protocol might  
simplify things a bit in terms of coordination.

Hope this helps,

L. Daniel Burr

More information about the Twisted-Python mailing list