WebStack

Annotated examples/Twisted/SimpleApp.py

308:31978c2f9b87
2004-12-20 paulb [project @ 2004-12-20 21:05:10 by paulb] Added notes on JythonServlet configuration. Updated Twisted notes.
paulb@39 1
#!/usr/bin/env python
paulb@39 2
paulb@39 3
from WebStack.Adapters import Twisted
paulb@41 4
from Simple import SimpleResource
paulb@39 5
import twisted.web.server
paulb@39 6
import twisted.internet.reactor
paulb@39 7
paulb@39 8
# Special magic incantation.
paulb@39 9
paulb@39 10
top_level = Twisted.Dispatcher(SimpleResource())
paulb@39 11
site = twisted.web.server.Site(top_level)
paulb@39 12
twisted.internet.reactor.listenTCP(8080, site)
paulb@265 13
print "Serving..."
paulb@39 14
twisted.internet.reactor.run()
paulb@39 15
paulb@39 16
# vim: tabstop=4 expandtab shiftwidth=4