[Twisted-Python] How to use NameVirtualHost?

Mukhsein Johari arashi1 at pd.jaring.my
Fri Jun 6 05:28:00 EDT 2003

Hi all,

What is the correct name for this class? In the source it's NameVirtualHost 
but in the docs it's NamedVirtualHost. Also in the API docs it says:

addHost(self, name, resrc)

Add a host to this virtual host.
This will take a host named `name', and map it to a resource `resrc'. For 
example, a setup for our virtual hosts would be:

   nvh.addHost('divunal.com', divunalDirectory)
   nvh.addHost('www.divunal.com', divunalDirectory)
   nvh.addHost('twistedmatrix.com', twistedMatrixDirectory)
   nvh.addHost('www.twistedmatrix.com', twistedMatrixDirectory)

But what kind of object is divualDirectory (for example)? I tried to put 
something like:
nvh.addHost('divunal.com', "/home/website/divunal.com/")

But I get an error:
'str' has no method getChildWithDefault!

In the dir /home/website/divunal.com/ there is an .rpy file index.rpy where a 
resource is defined. Twisted web could not find it? I'm still confused about 
how to properly use the vhost.* classes...

More information about the Twisted-Python mailing list