36
|
1 |
#!/usr/bin/python
|
|
2 |
|
|
3 |
import wsgiref.simple_server
|
|
4 |
import werkzeug
|
|
5 |
from werkzeug.exceptions import NotFound
|
|
6 |
|
|
7 |
import pngtile.wsgi
|
|
8 |
|
|
9 |
# dispatch on URL
|
|
10 |
app = werkzeug.DispatcherMiddleware(pngtile.wsgi.application, {
|
|
11 |
'/static': werkzeug.SharedDataMiddleware(NotFound(), {
|
|
12 |
'/': 'static',
|
|
13 |
}),
|
|
14 |
})
|
|
15 |
|
|
16 |
def main (host='127.0.0.1', port=8000) :
|
|
17 |
httpd = wsgiref.simple_server.make_server(host, port, app)
|
|
18 |
|
|
19 |
print "Listening on %s:%d" % (host, port)
|
|
20 |
|
|
21 |
httpd.serve_forever()
|
|
22 |
|
|
23 |
if __name__ == '__main__' :
|
|
24 |
main()
|
|
25 |
|