Skip to content

Commit

Permalink
Merge pull request #2752 from greyli/patch-9
Browse files Browse the repository at this point in the history
Check whether there are registered routes
  • Loading branch information
davidism committed May 2, 2018
2 parents a6a6810 + b4e0926 commit ad09134
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flask/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down

0 comments on commit ad09134

Please sign in to comment.