[Twisted-web] xmlrpc server daemon

Jean-Paul Calderone exarkun at divmod.com
Wed Feb 8 08:01:09 MST 2006


On Wed, 08 Feb 2006 11:14:12 -0200, Gustavo Rahal <gustavo at grahal.net> wrote:
>Hi
>
>How do I make my xmlrpc server a daemon?
>
>The code that starts the server is:
>
>r = rmsWebServices()
>xmlrpc.addIntrospection(r)
>reactor.listenTCP(7080, server.Site(r))
>reactor.run()
>
>What should I change?
>

Twisted comes with a daemonizer, `twistd'.  Rewrite the above as:

    from twisted.application import service, internet

    application = service.Application("RMS Web Service")
    ...
    website = internet.TCPServer(7080, server.Site(r))
    website.setServiceParent(application)

And then run it using "twistd -y <filename>".

Jean-Paul



More information about the Twisted-web mailing list