JaredKuolt / newf

A New (web) Framework for Python

This URL has Read+Write access

newf / example_app.py
100644 20 lines (14 sloc) 0.429 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from newf import Application, Response, ResponseRedirect
       
def foo(request):
    return Response("<h1>Hello World!</h1>")
 
def bar(request):
    return ResponseRedirect("/foo")
    
urls = (
    (r'^/foo$', foo),
    (r'^/bar$', bar),
)
 
application = Application(urls)
 
if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    server = make_server('', 8000, application)
    server.serve_forever()