[Twisted-Python] How to use NameVirtualHost?
Justin Ryan
justin at gnubia.net
Mon Jun 9 01:55:05 MDT 2003
addHost appears to be expecting a twisted.web.resource instance, not a
string that points to a directory containing an .rpy which defines one.
So, it seems logical that you will need to find a way to import the
resource from the .rpy file. Why not rename the index.rpy to
sitename.py, add the dir to sys.path, and import it?
On Fri, 2003-06-06 at 04:28, Mukhsein Johari wrote:
> 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...
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
More information about the Twisted-Python
mailing list