[Twisted-Python] Clearer information about virtual hosts

Matthew J. Probst matthew at yak.org
Tue Mar 4 13:15:29 MST 2003


I'm quite familiar with Python, but I'm having a hard time wrapping my mind 
round Twisted documentation.  I suspect that the given instructions aren't 
as useful until one understands a critical mass of the object models used, 
and that I haven't reached that point yet.

I've been trying to set up independent named virtual hosts serving static 
HTML from different directories.  I can't figure out how this can be made 
to work.  As a baseline I'm using the howto located at

http://www.twistedmatrix.com/documents/howto/using-twistedweb

Spreadable servers are mentioned, and appear to be part of the solution, 
but using the --help option on mktap shows no option allowing me to name 
each server, so how would traffic be routed to the appropriate virtual 
server?  I see VHostMonster, which can route to servers running on 
differnet ports, and I can see how that might help when combined with some 
kind of rewriting/subclassing through resources, but once again, is this 
the right model?

Perhaps the problem is that there are many models that work, with drawbacks 
and benefits, or just different qualities.  Or maybe I'm totally failing to 
see something that's obvious to those with more Twisted experience.  In any 
case, I feel like I'm just around the corner from some tidbit of 
information that will help me understand.

How about a simple example for serving static HTML?  Say I have HTML files 
in /var/www/www.foo.com and /var/www/www.bar.com, and that I want to serve 
these up as www.foo.com and www.bar.com, respectively.  Say they both 
reside on port 80 on the same server.  How might I accomplish this and get 
started with experimenting?  Granted, this does not use much of the power 
available, but would be a great start.





More information about the Twisted-Python mailing list