/examples/web/baseservers.py

https://bitbucket.org/prologic/circuits/ · Python · 22 lines · 8 code · 6 blank · 8 comment · 0 complexity · 9cf5cd4d3b8f620a9ac877a5687f6fcb MD5 · raw file

  1. #!/usr/bin/env python
  2. from circuits import Component
  3. from circuits.web import BaseServer
  4. class Root(Component):
  5. def request(self, request, response):
  6. """Request Handler
  7. Using ``BaseServer`` provides no URL dispatching of any kind.
  8. Requests are handled by any event handler listening to
  9. ``Request`` events and must accept a (request, response)
  10. as arguments.
  11. """
  12. return "Hello World!"
  13. app = BaseServer(("0.0.0.0", 8000))
  14. Root().register(app)
  15. app.run()