terom@36: #!/usr/bin/python terom@36: terom@36: import wsgiref.simple_server terom@36: import werkzeug terom@36: from werkzeug.exceptions import NotFound terom@106: import memcache terom@36: terom@36: import pngtile.wsgi terom@36: terom@106: def main (host='0.0.0.0', port=8000, memcache_host='localhost:11211') : terom@106: print "Using memcache server at %s" % memcache_host terom@36: terom@106: # cache terom@106: cache = memcache.Client([memcache_host]) terom@106: terom@106: # original app terom@106: app = pngtile.wsgi.WSGIApplication(cache) terom@106: terom@106: # serve up static content as well terom@106: app = werkzeug.SharedDataMiddleware(app, { terom@106: '/static': 'static', terom@103: }) terom@103: terom@103: # http server terom@36: httpd = wsgiref.simple_server.make_server(host, port, app) terom@36: terom@36: print "Listening on %s:%d" % (host, port) terom@103: terom@103: # go terom@36: httpd.serve_forever() terom@36: terom@36: if __name__ == '__main__' : terom@36: main() terom@36: