I've a working NameVirtualHost setup that I am trying to convert over to web2 and I've hit a speedbump. Here's the code, more or less:<br><br>===========================<br>from twisted.web2 import server, http, channel, vhost
<br>from twisted.web2 import static<br><br>root = vhost.NameVirtualHost()<br><br>site1 = server.Site(static.File("d:sites\site1"))<br>site2 = server.Site(static.File("d:sites\site2"))<br>
<br>root.addHost('<a href="http://www.grimmlabs.com">www.grimmlabs.com</a>', site1)<br>root.addHost('<a href="http://www.g-labs.com">www.g-labs.com</a>', site2)<br>
<br>site = server.Site(root)<br><br># Standard twisted application Boilerplate<br>from twisted.application import strports, service<br>from twisted.internet import reactor<br><br>application = service.Application
("Grimmlabs")<br>s = strports.service('tcp:8080', channel.HTTPFactory(site))<br>s.setServiceParent(application)<br>===========================<br>
<br>Run using twistd -ny file.py<br><br>Starts up, no probs. When I go to load a page, though, I see this traceback:<br><br>===========================<br>
File "E:\Python\Lib\site-packages\twisted\web2\server.py", line 263, in process<br> d = self._getChild(self.site.resource, self.postpath)<br> File "E:\Python\Lib\site-packages\twisted\web2\server.py", line 290, in _getChild
<br> return defer.maybeDeferred(<br> File "E:\Python\Lib\site-packages\twisted\internet\defer.py", line 191, in addCallbac<br>k<br> callbackKeywords=kw)<br> File "E:\Python\Lib\site-packages\twisted\internet\defer.py", line 182, in addCallbac
<br>ks<br> self._runCallbacks()<br> --- <exception caught here> ---<br> File "E:\Python\Lib\site-packages\twisted\internet\defer.py", line 307, in _runCallba<br>cks<br>
self.result = callback(self.result, *args, **kw)<br> File "E:\Python\Lib\site-packages\twisted\web2\server.py", line 317, in _handleSegmen<br>t<br> newres = iweb.IResource(newres)<br> File "E:\Python\lib\site-packages\zope\interface\interface.py", line 703, in __call__
<br><br> raise TypeError("Could not adapt", obj, self)<br> exceptions.TypeError: ('Could not adapt', <twisted.web2.server.Site object at 0x00D9157<br>0>, <SpecialAdaptInterfaceClass twisted.web2.iweb.IResource
>)<br>===========================<br>
<br>(sorry about the formatting)<br><br>I've tried a few variations with more or less the same results. Note that the sites I am trying to add all work just fine in web2 without the NameVirtualHost in the mix.<br><br>I've looked over the examples and what docs we have here, and haven't come up with any inspiration. Help me Obi-wan Kenobi, you're my only hope...
<br><br>-- <br>"Ladies and gentlemen, there's nothing to worry about ... but please keep your heads down." - The Muppet Show<br><br>Best,<br><br> Jeff