public
Description: Turtles all the way down
Homepage: http://simonwillison.net/2009/May/19/djng/
Clone URL: git://github.com/simonw/djng.git
djng / example_middleware.py
100644 16 lines (11 sloc) 0.317 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import djng
 
def hello(request):
    return djng.Response('Hello, world ' * 100)
 
def goodbye(request):
    return djng.Response('Goodbye, world ' * 100)
 
app = djng.Router(
    (r'^hello$', hello),
    (r'^goodbye$', djng.middleware.GZip(goodbye)),
)
 
if __name__ == '__main__':
    djng.serve(app, '0.0.0.0', 8888)