Opened 3 years ago

Closed 3 years ago

#32870 closed Cleanup/optimization (fixed)

Added message when user mispells 'urlpatterns' in some 'urls' module

Reported by: Igor Kuivjogi Fernandes Owned by: Igor Kuivjogi Fernandes
Component: Core (URLs) Version: 3.2
Severity: Normal Keywords:
Cc: 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

I found this kind of error when I mispelled urlspattern instead of urlpatterns inside my blog/urls.py file.
So the console was throwing an error, but this error do not helped me to found the problem. Check it:

django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'blog.urls'
from '.../my_project/blog/urls.py'>' does not
 appear to have any patterns in it. If you see valid patterns in the file then the
 issue is probably caused by a circular import.

The problem is not with a circular import, but with the mispelled urlpatterns variable itself, so I'm doing this ticket.

OBS.: I have already created a pull request for this: https://github.com/django/django/pull/14453

I appreciate any feedback.
Thanks,
Igor

Change History (4)

comment:1 by Jacob Walls, 3 years ago

Has patch: set
Owner: changed from nobody to Igor Kuivjogi Fernandes
Status: newassigned
Type: UncategorizedCleanup/optimization

comment:2 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Agreed, we can improve an error message.

comment:3 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In e85d9c02:

Fixed #32870 -- Improved error message when URLconf is empty.

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