fix application profiling

This commit is contained in:
Martin Zimmermann 2013-11-05 23:36:52 +01:00
parent 0a247a7927
commit 6374d8a9e1

View File

@ -169,13 +169,16 @@ def make_app(conf=None):
logger.warn("unable to connect to HTTP server")
if isso.conf.getboolean("server", "profile"):
from werkzeug.contrib.profiler import ProfilerMiddleware
isso = ProfilerMiddleware(isso, sort_by=("cumtime", ), restrictions=("isso/(?!lib)", ))
from werkzeug.contrib.profiler import ProfilerMiddleware as Profiler
ProfilerMiddleware = lambda app: Profiler(app, sort_by=("cumtime", ), restrictions=("isso/(?!lib)", 10))
else:
ProfilerMiddleware = lambda app: app
app = ProxyFix(
wsgi.SubURI(
wsgi.CORSMiddleware(
SharedDataMiddleware(isso, {
SharedDataMiddleware(
ProfilerMiddleware(isso), {
'/js': join(dirname(__file__), 'js/'),
'/css': join(dirname(__file__), 'css/')}),
list(isso.conf.getiter("general", "host")))))