# HG changeset patch # User Tero Marttila # Date 1264462650 -7200 # Node ID 26f10ed59c8e2d82a27866a0cdb796624794ca1d # Parent 30c091643f75609d353123df97522cf23cbb1799 clean up dev-server stuff, and construct memcache client.. diff -r 30c091643f75 -r 26f10ed59c8e bin/dev-server --- a/bin/dev-server Tue Jan 26 01:37:16 2010 +0200 +++ b/bin/dev-server Tue Jan 26 01:37:30 2010 +0200 @@ -3,19 +3,22 @@ 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) : - # original app - app = pngtile.wsgi.WSGIApplication() +def main (host='0.0.0.0', port=8000, memcache_host='localhost:11211') : + print "Using memcache server at %s" % memcache_host - # dispatch on URL - # XXX: just replace with SharedDataMiddleware.. - app = werkzeug.DispatcherMiddleware(app, { - '/static': werkzeug.SharedDataMiddleware(NotFound(), { - '/': 'static', - }), + # 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