from django.urls.resolvers import RegexURLPattern
from django.urls.resolvers import RegexURLResolver
from django.shortcuts import HttpResponse
url = []
def show_urls(urllist, footer=None):
for entry in urllist:
if hasattr(entry, 'url_patterns'):
if entry.regex.pattern:
show_urls(entry.url_patterns)
else:
url.append((entry.regex.pattern, entry.name))
show_urls(urlpatterns)
print(url)
网友评论