webserver application (via Twisted?)

Jp Calderone exarkun at divmod.com
Fri Jun 24 10:26:53 EDT 2005


On Fri, 24 Jun 2005 12:35:40 GMT, flupke <flupke at nonexistingdomain.com> wrote:
>I need to program and setup serveral webservices.
>If i were still using jsp, i would use Tomcat to make the several
>applications available on a given port.
>How can i accomplish this in Python?
>I was thinking about Twisted but it's not clear to me what parts i need
>to make a webserver listen on a certain port and having it serve
>different application based on the url that i received.
>
>Any advice on this?

Roughly,

    from twisted.web import server, resource
    from twisted.internet import reactor

    root = resource.Resource()
    root.putChild("app1", getApp1())
    root.putChild("app2", getApp2())
    ...
    site = server.Site(root)
    reactor.listenTCP(80, site)
    reactor.run()

You might also want to join the twisted-web mailing list: http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Jp



More information about the Python-list mailing list