Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13542 closed (wontfix)

Feature request: Debug 404 URL patterns as links

Reported by: erw Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


When you get the debug 404 page, it says, for example:

Using the URLconf defined in urls, Django tried these URL patterns, in this order:

1. ^user/
2. ^ratings/
3. ^ratings/user/(?P<user_id>\d+)/$

The current URL, , didn't match any of these.

It would be nice if the simple ones (1 and 2 above) were links, simply to /user/ and /ratings/. I've included a quick patch that does that.

To work on URLconfs included from the main URLconf it needs some improvement, but I don't know how to do that and don't want to work on it unless the feature in general is found relevant. The regex probably also needs some more thought.

Attachments (1)

debug_404_links.diff (1.2 KB) - added by erw 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by erw

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Thanks for the suggestion, but I fear this would cause more confusion than shed light during debugging -- I don't think it would be at all clear to many why some patterns get links associated with them and others do not. Also, the key question for the programmer when faced with an unexpected 404 page is "Why didn't any of the listed patterns match?", and having some of the patterns show as links does not help answer that question, so they would strike me as more of a distraction than anything else. (Also, for future reference, Django supports Pythons as far back as 2.4. format is new in Python 2.6 so the proposed patch could not be used as-is if this were to be done; it would need to be reworked so the code ran on Pythons as old as 2.4.)

comment:2 Changed 5 years ago by erw

Yeah, I see your point. I just made it because I was working on a project which had no root page for at long time. Also, forgot about format. I'll remember that for another time!

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