Opened 15 months ago

Last modified 15 months ago

#30728 closed Bug

Django urls patterns resolver shadowing exceptions thrown everywhere else — at Version 1

Reported by: Ariel Torti Owned by: nobody
Component: Utilities Version: 2.2
Severity: Release blocker Keywords:
Cc: Tom Forbes Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ariel Torti)

The new version of django somehow captures all the exceptions ocurred while parsing the urlpatterns.

How to reproduce:

  • Create a django project
  • Create a an app


from django.shortcuts import render

class MyCustomExceptionShadowed(Exception):

raise MyCustomExceptionShadowed('I have a description of your error')

# Create your views here.
def myview(request):

from django.contrib import admin
from django.urls import path

from bugtest import views

urlpatterns = [
    path('', views.myview),

When running the server I get

django.core.exceptions.ImproperlyConfigured: The included URLconf 'bug.urls' 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.

When in fact I expect it to say

  File "/home/ariel-nt/Desktop/test/bug/bugtest/", line 6, in <module>
    raise MyCustomExceptionShadowed('I have a description of your error')
bugtest.views.MyCustomExceptionShadowed: I have a description of your error

I tested this with django 2.1 and it works as expected, so I'll now try to find the root cause of the error and give an update here
The issue in introduced in this commit
This line absorbs all the exceptions not showing them to the developer.

Change History (1)

comment:1 Changed 15 months ago by Ariel Torti

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top