Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 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:

Description

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 4 years ago.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by erw

comment:1 Changed 4 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 4 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!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.