Opened 15 years ago

Closed 15 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: no UI/UX: no

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 15 years ago.

Download all attachments as: .zip

Change History (3)

by dmach, 15 years ago

Attachment: load_app-importerror.patch added

comment:1 by Tomáš Kopeček, 15 years ago

Cc: permonik@… added

comment:2 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

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