bin/dev-server
author Tero Marttila <terom@paivola.fi>
Sun, 14 Sep 2014 23:18:35 +0300
changeset 141 19a3ed063d18
parent 106 26f10ed59c8e
permissions -rwxr-xr-x
pngtile.image: leaflet browser for tiles; coordinates are still wonky..
#!/usr/bin/python

import wsgiref.simple_server
import werkzeug
from werkzeug.exceptions import NotFound
import memcache

import pngtile.wsgi

def main (host='0.0.0.0', port=8000, memcache_host='localhost:11211') :
    print "Using memcache server at %s" % memcache_host

    # cache
    cache = memcache.Client([memcache_host])

    # original app
    app = pngtile.wsgi.WSGIApplication(cache)

    # serve up static content as well
    app = werkzeug.SharedDataMiddleware(app, {
        '/static':          'static',
    })
    
    # http server
    httpd = wsgiref.simple_server.make_server(host, port, app)

    print "Listening on %s:%d" % (host, port)
    
    # go
    httpd.serve_forever()

if __name__ == '__main__' :
    main()