runserver.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
New commits:
commit b33c090774f79a3249e1f94d5d319dd8ae169127
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sun Nov 30 09:44:25 2014 +0100
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()
Show replies by date