[Twisted-web] Nevow and distrib

Matt Goodall matt at pollenation.net
Sun Jul 11 21:01:24 MDT 2004


Hi all,

Attached is a distrib module and a patch to nevow/appserver.py that
allows Nevow to work behind a distrib server. Yippee! I claim no credit
for the distrib module, I ripped it from new-web. The change to
appserver.py is almost certainly not robust enough but ti works for a
simple distrib server. Patches will be most welcome as you fix the
bugs ;-).

You don't need a Publisher with this as it's all proxy based. I imagine
the proxy will work over a UNIX socket but I only tested over TCP. Below
is the server I used to test:

from twisted.application import service
from twisted.application import internet
from nevow import appserver, distrib

application = service.Application('distribtest')
internet.TCPServer(
    8000,
    appserver.NevowSite(
        distrib.ResourceSubscription('localhost', 8001)
    )
).setServiceParent(application)

Also, I imagine it's relatively easy to use the same technique to hide a
Nevow app behind Apache. It's just a matter of adding a 'x-forwarded-
from' header to the request before proxying it to the twistd server (see
distrib.py). mod_proxy + mod_headers should help, maybe mod_rewrite too.

Hope this is of interest.

Cheers, Matt


-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: distrib.py
Type: application/x-python
Size: 1134 bytes
Desc: not available
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040712/ca54cc7c/distrib.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: distrib-appserver.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040712/ca54cc7c/distrib-appserver.bin


More information about the Twisted-web mailing list