Answer the question
In order to leave comments, you need to log in
Is there a ready-made module similar to rake stats for Flask?
I wanted to get something like this output
. For url, I used this snippet , but I'm interested in statistics: the number of models, controllers, libraries, and everything like that.
@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))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question