Is there a way to get the complete django url configuration?
For example Django’s debugging 404 page does not show included url configs, so this is not the complete configuration.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Django is Python, so introspection is your friend.
In the shell, import
urls. By looping throughurls.urlpatterns, and drilling down through as many layers of included url configurations as possible, you can build the complete url configuration.The list
urls.urlpatternscontainsRegexURLPatternandRegexURLResolverobjects.For a
RegexURLPatternobjectpyou can display the regular expression withFor a
RegexURLResolverobjectq, which represents an included url configuration, you can display the first part of the regular expression withThen use
which will return a further list of
RegexURLResolverandRegexURLPatternobjects.