Created
June 4, 2014 13:35
-
-
Save caio-nas/20444330b9c7243bd773 to your computer and use it in GitHub Desktop.
This file contains 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 characters
@manager.command | |
def list_routes(): | |
import urllib | |
from flask import url_for | |
output = [] | |
for rule in app.url_map.iter_rules(): | |
options = {} | |
for arg in rule.arguments: | |
options[arg] = "[{0}]".format(arg) | |
methods = ','.join(rule.methods) | |
url = url_for(rule.endpoint, **options) | |
line = urllib.unquote("{:50s} {:20s} {}".format(rule.endpoint, methods, url)) | |
output.append(line) | |
for line in sorted(output): | |
logger.debug(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment