Opened 3 years ago

Last modified 3 years ago

#28800 new New feature

Add a management command to list URL patterns

Reported by: Martín Peveri Owned by: nobody
Component: Core (Management commands) Version: 1.11
Severity: Normal Keywords:
Cc: Keryn Knight Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


It would be practical to visualize all the urls of the application in a command, is it possible?. If it is not possible, it is something like this:

python routes

Change History (5)

comment:1 Changed 3 years ago by Tim Graham

django-extensions has a show_urls command which "produce a tab-separated list of (url_pattern, view_function, name) tuples for a project." I'm not sure that this needs to be incorporated into Django itself.

comment:2 in reply to:  1 Changed 3 years ago by Martín Peveri

I understand, but I depend on an extension. Tell me if you consider it to integrate it into the framework and I could send an RP. Thanks!

comment:3 Changed 3 years ago by Keryn Knight

Cc: Keryn Knight added

Can I suggest that its worth taking to the developers mailing list to discuss this possibility? As an anecdotal datapoint, I know I semi-frequently make use such a command when coming into a project which I've not previously been heavily involved with. The flat output (vs traversing a list of include() usages) gives a decent overview on what's what, and the contrib.admindocs package already provides a similar overview if installed into the admin.

It also isn't a huge amount of new work (in my mind, because I wrote a similar thing to the django-extensions command) precisely because it can depend on the same functions admindocs does. So the maintenance burden is arguably mostly already in place.

comment:4 Changed 3 years ago by Martín Peveri

I think what Keryn Knight said is good. If approved, I could work on the ticket and send a PR.

Last edited 3 years ago by Martín Peveri (previous) (diff)

comment:5 Changed 3 years ago by Tim Graham

Component: Core (URLs)Core (Management commands)
Summary: List routes in the consoleAdd a management command to list URL patterns
Triage Stage: UnreviewedSomeday/Maybe

Someone could try to get a consensus on the DevelopersMailingList about this. I've never had a need for it myself. A rough criteria I've used for thinking about whether or not something should be in core is whether 80% of projects use it. The existence of an implementation in django-extensions demonstrates this can live as a third-party library which seems sufficient to me.

Note: See TracTickets for help on using tickets.
Back to Top