From 7835c2470d833635139561d50796ee42ea6692df Mon Sep 17 00:00:00 2001 From: Edwin Henneken Date: Tue, 16 Aug 2016 10:16:26 -0400 Subject: [PATCH] integrated profiling --- CHANGES.md | 4 ++++ service/manage.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index d9f5306..7aa2325 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +### 1.0.14 + +* add profiling command to manage.py + ### 1.0.13 * removed Consul dependencies diff --git a/service/manage.py b/service/manage.py index 5e58757..b29a34d 100644 --- a/service/manage.py +++ b/service/manage.py @@ -16,5 +16,13 @@ manager.add_command('db', MigrateCommand) +@manager.command +def profile(length=25, profile_dir=None): + """Start the application under the code profiler.""" + from werkzeug.contrib.profiler import ProfilerMiddleware + app_.wsgi_app = ProfilerMiddleware(app_.wsgi_app, restrictions=[length], + profile_dir=profile_dir) + app_.run() + if __name__ == '__main__': manager.run()