Opened 5 years ago

Closed 5 years ago

#12360 closed (duplicate)

Improve db.models.loading.load_app ImportError handling

Reported by: dmach Owned by: nobody
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords:
Cc: permonik@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I copied a django project from server to my workstation to dump the sqlite database (I have more RAM here).
I was wondering why dumpdata didn't dump all tables.
When I ran manage.py dumpdata <app>, django kept telling me: Error: Unknown application: <app>
I found that some apps used older version of a 3rd party library which didn't have some features implemented yet.

Such errors are well hidden and the reason is that load_app doesn't distinguish between these 2 cases:

  • app.models doesn't exist
  • ImportError is raised in app.models (or any module imported in app.models)

Attached patch should fix this problem.

Attachments (1)

load_app-importerror.patch (722 bytes) - added by dmach 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by dmach

comment:1 Changed 5 years ago by permon

  • Cc permonik@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by kmtracey

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

This is #11696. You might want to try the attached path on that ticket and see how well it works. Returning to the old way of importing (which is what, I think, is in the patch here) is likely not going to be the way this is fixed, since the import changes were done to fix another problem. So feedback on the patch on the other ticket (which I've only glanced at to the point of seeing it does not just revert to the old way of importing) would be useful.

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