import urls # or from app import urls
def print_urls(patterns, indent=0):
for u in patterns:
if u.callback:
print '-'*indent, u.regex.pattern, u.callback
else:
print '='*(indent+1), u.regex.pattern
print_urls(u.url_patterns, indent+3)
print_urls(urls.urlpatterns)
1条答案
按热度按时间vshtjzan1#
您需要从项目导入
urls
模块。urls.urlpatterns
就是您要查找的模块。请尝试使用此函数: