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