From b4e092600dc2cfd5326a373b4b9fd757a5d8a61a Mon Sep 17 00:00:00 2001 From: Grey Li Date: Wed, 2 May 2018 17:08:31 +0800 Subject: [PATCH] Check whether exist registered routes --- flask/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flask/cli.py b/flask/cli.py index 635abb13..efc1733e 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -825,6 +825,10 @@ def routes_command(sort, all_methods): """Show all registered routes with endpoints and methods.""" rules = list(current_app.url_map.iter_rules()) + if not rules: + click.echo('No routes were registered.') + return + ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS')) if sort in ('endpoint', 'rule'):