django 검색 항목의 모든 URL

483 단어

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)

좋은 웹페이지 즐겨찾기