equal
deleted
inserted
replaced
1 #!/usr/bin/python |
|
2 |
|
3 import wsgiref.simple_server |
|
4 import werkzeug |
|
5 from werkzeug.exceptions import NotFound |
|
6 import memcache |
|
7 |
|
8 import pngtile.wsgi |
|
9 |
|
10 def main (host='0.0.0.0', port=8000, memcache_host='localhost:11211') : |
|
11 print "Using memcache server at %s" % memcache_host |
|
12 |
|
13 # cache |
|
14 cache = memcache.Client([memcache_host]) |
|
15 |
|
16 # original app |
|
17 app = pngtile.wsgi.WSGIApplication(cache) |
|
18 |
|
19 # serve up static content as well |
|
20 app = werkzeug.SharedDataMiddleware(app, { |
|
21 '/static': 'static', |
|
22 }) |
|
23 |
|
24 # http server |
|
25 httpd = wsgiref.simple_server.make_server(host, port, app) |
|
26 |
|
27 print "Listening on %s:%d" % (host, port) |
|
28 |
|
29 # go |
|
30 httpd.serve_forever() |
|
31 |
|
32 if __name__ == '__main__' : |
|
33 main() |
|
34 |
|