Opened 7 years ago
Last modified 3 days ago
#28800 assigned New feature
Add a management command to list URL patterns
Reported by: | Martín Peveri | Owned by: | Ülgen Sarıkavak |
---|---|---|---|
Component: | Core (Management commands) | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Keryn Knight, Adam Johnson, Ryan Hiebert, Chris Rose | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 manage.py routes
Change History (20)
follow-up: 2 comment:1 by , 7 years ago
comment:2 by , 7 years ago
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 by , 7 years ago
Cc: | 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 by , 7 years ago
I like what I say Keryn Knight. If approved, I could work on the ticket and send a PR.
comment:5 by , 7 years ago
Component: | Core (URLs) → Core (Management commands) |
---|---|
Summary: | List routes in the console → Add a management command to list URL patterns |
Triage Stage: | Unreviewed → Someday/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.
comment:6 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 2 years ago
Triage Stage: | Someday/Maybe → Accepted |
---|
Discussion at DjangoCon US 2022 suggests it would be a popular enough feature.
follow-up: 12 comment:8 by , 19 months ago
Cc: | added |
---|
comment:10 by , 12 months ago
I have the feature finished I just haven't had time to finished up the tests and documentation. Hopefully my day job will slow down a bit and I can get a PR in next month.
comment:11 by , 10 months ago
Owner: | changed from | to
---|
comment:12 by , 6 months ago
Replying to Keanya Phelps:
Not sure if this change was made intentionally or by mistake.
Replying to Xavier Tilley:
I have the feature finished I just haven't had time to finished up the tests and documentation. Hopefully my day job will slow down a bit and I can get a PR in next month.
Do you still plan to make these changes?
Replying to Adam Johnson:
Could we push this feature?
comment:13 by , 5 months ago
Cc: | added |
---|
follow-up: 15 comment:14 by , 5 months ago
Cc: | added |
---|---|
Has patch: | set |
Needs tests: | set |
Version: | 1.11 → 5.1 |
I've picked up the work started by Xavier Tilley and pushed a bit more onto it: https://github.com/django/django/pull/18347
comment:15 by , 3 weeks ago
Owner: | changed from | to
---|
I've pinged Chris under the Github issue and with his approval, I'm taking the task. My plan is, first to consider which formatting options are needed, then to push the finalized version this weekend.
Replying to Chris Rose:
I've picked up the work started by Xavier Tilley and pushed a bit more onto it: https://github.com/django/django/pull/18347
comment:16 by , 2 weeks ago
Patch needs improvement: | set |
---|
comment:18 by , 3 days ago
Needs tests: | unset |
---|
comment:19 by , 3 days ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:20 by , 3 days ago
Triage Stage: | Ready for checkin → Accepted |
---|
I'm a bit confused about who should set the "Ready for checkin" flag. The current info box on this page says
For a Django committer to do a final review of the patch and merge it if all looks good.
so I thought this is the correct state to be in but now the issue is no longer visible under https://code.djangoproject.com/query?status=!closed&needs_better_patch=0&needs_tests=0&needs_docs=0&has_patch=1&stage=Accepted&desc=1&order=changetime so I guess I shouldn't have touched that flag. Considering
If you’re really not certain if a ticket is ready, don’t mark it as such.
warning from https://docs.djangoproject.com/en/dev/internals/contributing/new-contributors/#be-cautious-when-marking-things-ready-for-check-in , I'm changing that flag back.
Sorry for the extra notifications going to the followers of the issue.
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.