From b33c090774f79a3249e1f94d5d319dd8ae169127 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 30 2014 08:44:25 +0000 Subject: Activate the profiler with --profile --- diff --git a/runserver.py b/runserver.py index 5f21658..922f528 100755 --- a/runserver.py +++ b/runserver.py @@ -1,8 +1,16 @@ #!/usr/bin/env python import __main__ -__main__.__requires__ = ['SQLAlchemy >= 0.7'] +__main__.__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4'] import pkg_resources +import sys +from werkzeug.contrib.profiler import ProfilerMiddleware + from fedora_elections import APP APP.debug = True + +if '--profile' in sys.argv: + APP.config['PROFILE'] = True + APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) + APP.run()