equal
deleted
inserted
replaced
4 import werkzeug |
4 import werkzeug |
5 from werkzeug.exceptions import NotFound |
5 from werkzeug.exceptions import NotFound |
6 |
6 |
7 import pngtile.wsgi |
7 import pngtile.wsgi |
8 |
8 |
9 # dispatch on URL |
9 def main (host='0.0.0.0', port=8000) : |
10 app = werkzeug.DispatcherMiddleware(pngtile.wsgi.application, { |
10 # original app |
11 '/static': werkzeug.SharedDataMiddleware(NotFound(), { |
11 app = pngtile.wsgi.WSGIApplication() |
12 '/': 'static', |
|
13 }), |
|
14 }) |
|
15 |
12 |
16 def main (host='0.0.0.0', port=8000) : |
13 # dispatch on URL |
|
14 # XXX: just replace with SharedDataMiddleware.. |
|
15 app = werkzeug.DispatcherMiddleware(app, { |
|
16 '/static': werkzeug.SharedDataMiddleware(NotFound(), { |
|
17 '/': 'static', |
|
18 }), |
|
19 }) |
|
20 |
|
21 # http server |
17 httpd = wsgiref.simple_server.make_server(host, port, app) |
22 httpd = wsgiref.simple_server.make_server(host, port, app) |
18 |
23 |
19 print "Listening on %s:%d" % (host, port) |
24 print "Listening on %s:%d" % (host, port) |
20 |
25 |
|
26 # go |
21 httpd.serve_forever() |
27 httpd.serve_forever() |
22 |
28 |
23 if __name__ == '__main__' : |
29 if __name__ == '__main__' : |
24 main() |
30 main() |
25 |
31 |