[Twisted-Python] Woven example for article, Part II
Itamar Shtull-Trauring
itamar at itamarst.org
Wed May 28 22:30:27 MDT 2003
On Wed, 28 May 2003 17:20:39 -0500 (CDT)
> I don't really understand Twisted well enough to know what the
> most logical approach to this next variant would be. It seems
> like woven is the main web technology in Twisted... but given my
> problems running even the bundled example, I'm not sure how to
> proceed.
Woven is built on top of twisted.web. You probably want to look at
twisted.web.resource,
http://twistedmatrix.com/documents/howto/web-overview,
twisted.protocol.http.Request and the web examples. Also
http://twistedmatrix.com/users/nafai/pycon-paper/
Not much docs for these parts, but its pretty simple:
from twisted.web import server, static, resource
from twisted.internet import reactor
class MyResource(resource.Resource):
def render(self, request):
return "<html><body>%s</body></html>" % request.args
r = MyResource()
r.putChild("pages", static.File("/var/www"))
reactor.listenTCP(8080, server.Site(r))
reactor.run()
--
Itamar Shtull-Trauring http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting
More information about the Twisted-Python
mailing list