/examples/web/wsgi.py

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

  1. #!/usr/bin/env python
  2. from circuits.web.wsgi import Gateway
  3. from circuits.web import Controller, Server
  4. def foo(environ, start_response):
  5. start_response("200 OK", [("Content-Type", "text/plain")])
  6. return ["Foo!"]
  7. class Root(Controller):
  8. """App Rot"""
  9. def index(self):
  10. return "Hello World!"
  11. app = Server(("0.0.0.0", 10000))
  12. Root().register(app)
  13. Gateway({"/foo": foo}).register(app)
  14. app.run()