Opened 11 years ago
Closed 11 years ago
#21435 closed Cleanup/optimization (fixed)
Improved error message for reverse v. reverse_lazy
Reported by: | Elena Williams | Owned by: | Bas Peschier |
---|---|---|---|
Component: | Core (URLs) | Version: | 1.6 |
Severity: | Normal | Keywords: | nlsprint14 |
Cc: | eromijn@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
ImproperlyConfigured: The included urlconf %s doesn't have any patterns in it.
Uninformative foremost as %s is top-level urls (problem usually in included urls).
Caused by using reverse rather than reverse_lazy in some view.
No feedback whatsoever is given as to:
- that the error is caused in view rather than url
- which view this might be, or even which app it is in
Context: You get this error starting the developer server. The error is cached (#11712) and fixing it doesn't make the error go away adding to the confusion.
Suggestion: At least more specificity as to where the error lies.
Related tickets:
- https://code.djangoproject.com/ticket/17084
- https://code.djangoproject.com/ticket/15685
- https://code.djangoproject.com/ticket/11712
The above added here: https://code.djangoproject.com/wiki/BetterErrorMessages
Appears be reproducible by adding to any view:
from django.core.urlresolvers import reverse class DetailView(generic.DetailView): ... attr = reverse('anything')
Change History (8)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 11 years ago
Component: | Uncategorized → Core (URLs) |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 11 years ago
Keywords: | nlsprint14 added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 11 years ago
Tweaked the error message, PR on https://github.com/django/django/pull/2343
comment:7 by , 11 years ago
Cc: | added |
---|---|
Triage Stage: | Accepted → Ready for checkin |
This looks fine to me, and the tests succeed.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Indeed, we could provide an error message hinting at the most likely cause — a circular import.