Improve db.models.loading.load_app ImportError handling
|Reported by:||dmach||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.