[Twisted-Python] Twisted and mod_python?

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Nov 11 22:29:13 MST 2003


Itamar Shtull-Trauring wrote:

> You'd need to start the Twisted event loop up on each HTTP request.
> Or... kinda. It's possible anyway, but you'll need to investigate
> mod_python's interpreter lifetime model.

It's theoretically possible, but almost certainly a bad idea.  Do you 
already have a large mod_python-using codebase?

If not, Twisted includes HTTP support for a reason.  Just use it :).  To 
communicate with your apache server, use mod_proxy or something similar 
to just relay requests to the Twisted web server.

If you do have a large mod_python-using application already and you are 
trying to get it to talk to Twisted, you probably want to continue to 
use the mod_python execution model rather than spin up the twisted event 
loop and switch back and forth: while it's possible if you really need 
it, a better architectural strategy in the average case (to avoid odd 
interactions between the assumptions mod_python has about its 
environment and the assumptions twisted has about its) would be to use 
Twisted's XMLRPC support and talk to it using a blocking XMLRPC library 
from your mod_python scripts.


but-ask-me-again-when-warner-finishes-newpb-ly y'rs,

	-glyph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 256 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20031112/ce6aec11/attachment.sig>


More information about the Twisted-Python mailing list