Opened 7 years ago

Closed 7 years ago

#17047 closed Bug (fixed)

django.db.utils.load_backend gives confusing error for unqualified db backend name

Reported by: Carl Meyer Owned by: Jonas Obrist
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


If someone upgrades to trunk/1.4, missed the deprecation warnings, and still has e.g. "sqlite3" for a database ENGINE setting, the error message they get is a completely opaque "ImportError: no module named base"

load_backend goes to some lengths to give a helpful error message in the case of a totally bogus backend, but oddly in the case of a backend that is not fully-qualified but does exist, it bails with the comment "this must be an error in Django itself." That comment/code is just wrong - it would be easy to add a helpful error message for this case.

Attachments (1)

17047.patch (5.3 KB) - added by Jonas Obrist 7 years ago.
patch and tests

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by Jonas Obrist

Owner: changed from nobody to Jonas Obrist

Changed 7 years ago by Jonas Obrist

Attachment: 17047.patch added

patch and tests

comment:2 Changed 7 years ago by Jonas Obrist

Easy pickings: set
Has patch: set

comment:3 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

In [17274]:

Fixed #17047 -- Improved django.db.utils.load_backend to raise a better exception when using a unqualified database backend name. Thanks, Jonas Obrist.

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