PageRenderTime 152ms CodeModel.GetById 143ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 3from circuits.web.wsgi import Gateway
 4from circuits.web import Controller, Server
 5
 6
 7def foo(environ, start_response):
 8    start_response("200 OK", [("Content-Type", "text/plain")])
 9    return ["Foo!"]
10
11
12class Root(Controller):
13    """App Rot"""
14
15    def index(self):
16        return "Hello World!"
17
18
19app = Server(("0.0.0.0", 10000))
20Root().register(app)
21Gateway({"/foo": foo}).register(app)
22app.run()