/examples/web/controllers.py

https://bitbucket.org/prologic/circuits/ · Python · 23 lines · 10 code · 6 blank · 7 comment · 0 complexity · c123724e607d860b48314aa8840b3c66 MD5 · raw file

  1. #!/usr/bin/env python
  2. from circuits.web import Server, Controller, Static
  3. class Root(Controller):
  4. def index(self):
  5. """Index Request Handler
  6. Controller(s) expose implicitly methods as request handlers.
  7. Request Handlers can still be customized by using the ``@expose``
  8. decorator. For example exposing as a different path.
  9. """
  10. return "Hello World!"
  11. app = Server(("0.0.0.0", 9000))
  12. from circuits import Debugger
  13. Debugger().register(app)
  14. Static().register(app)
  15. Root().register(app)
  16. app.run()