The django-extensions library has a fantastic management command called show_urls which will print all of the urls in your project. This is an extremely helpful debugging tool when dealing with URL routing issues. At the same time, it seems like it’s a somewhat unknown tool.
I’d like this to be included. I don’t always have Django-extensions installed, but I often deliberately hit the 404 page in order to get the list of URLs patterns displayed. Being able to just do that at the CLI would save a bit of silliness there. (So a +1 from me.)
While I can’t say that I use it weekly or monthly, when I need it, I go out of my way to install django-extensions if it’s not already installed in a project to use it.
Otherwise, I have to go deep into a project’s code to try and figure out what some third-party package may or may not have named their URL path. Even then, you must still know the names space if it’s passed to the path or a router name.
So, show_urls solves an unobvious problem that I’m unsure how else to figure out.
Currently I do the exact same thing that Carlton described, particularly I always use http://localhost:8000/foo/ to get there. The day that a 3rd party app decides to provide a valid view under foo I’m doomed!
I use show_urls regularly and find debugging URL matches one of the more frustrating parts of Django development. In several projects I’ve either installed django_extensions temporarily or copied the code to a live console at some point.
Strong +1 to include functionality like this in Django-proper – it doesn’t seem too complex, depending on if we want all the different output options etc.
2. Do you use it regularly?
Yes, more than any other management command. Especially after black took over the world, it’s become hard to quickly “scan” the URL structure by just looking at the code, so having it in table form is very useful.
3. Do you feel like Django’s standard library should contain a similar command?
Yes, although it could probably be acceptable to only output CSV, for further processing by other commands like xsv.