Created
July 2, 2015 12:49
-
-
Save gunlinux/b6f156bc1ddd76e4e2f7 to your computer and use it in GitHub Desktop.
Revisions
-
gunlinux created this gist
Jul 2, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import os from app import create_app, db from flask_script import Manager, Shell app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) @manager.command def stat(): models = db.get_binds() methods = set() blueprints = set() rules_count = 0 for rule in app.url_map.iter_rules(): rules_count += 1 blueprints.update([rule.endpoint.split('.')[0]]) methods.update(rule.methods) print('{0:10} {1:5}\n'.format('Name', 'Count')) print('{0:10} {1:5}'.format('Models', len(models))) print('{0:10} {1:5}'.format('Methods', len(methods))) print('{0:10} {1:5}'.format('Blueprints', len(blueprints))) print('{0:10} {1:5}'.format('Rules', rules_count))