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()