Opened 5 years ago

Closed 4 years ago

#17047 closed Bug (fixed)

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

Reported by: carljm Owned by: ojii
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 ojii 4 years ago.
patch and tests

Download all attachments as: .zip

Change History (4)

comment:1 Changed 4 years ago by ojii

  • Owner changed from nobody to ojii

Changed 4 years ago by ojii

patch and tests

comment:2 Changed 4 years ago by ojii

  • Easy pickings set
  • Has patch set

comment:3 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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