add missing dev-server script
authorTero Marttila <terom@fixme.fi>
Wed, 06 Jan 2010 16:32:00 +0200
changeset 36 caabf287c75e
parent 35 314aa047a910
child 37 a6fc2c58e25b
add missing dev-server script
bin/dev-server
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/dev-server	Wed Jan 06 16:32:00 2010 +0200
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import wsgiref.simple_server
+import werkzeug
+from werkzeug.exceptions import NotFound
+
+import pngtile.wsgi
+
+# dispatch on URL
+app = werkzeug.DispatcherMiddleware(pngtile.wsgi.application, {
+    '/static':      werkzeug.SharedDataMiddleware(NotFound(), {
+        '/':            'static',
+    }),
+})
+
+def main (host='127.0.0.1', port=8000) :
+    httpd = wsgiref.simple_server.make_server(host, port, app)
+
+    print "Listening on %s:%d" % (host, port)
+
+    httpd.serve_forever()
+
+if __name__ == '__main__' :
+    main()
+