Skip to content

Commit ad09134

Browse files
authored
Merge pull request pallets#2752 from greyli/patch-9
Check whether there are registered routes
2 parents a6a6810 + b4e0926 commit ad09134

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flask/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,10 @@ def routes_command(sort, all_methods):
825825
"""Show all registered routes with endpoints and methods."""
826826

827827
rules = list(current_app.url_map.iter_rules())
828+
if not rules:
829+
click.echo('No routes were registered.')
830+
return
831+
828832
ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))
829833

830834
if sort in ('endpoint', 'rule'):

0 commit comments

Comments
 (0)