improved error message on apps without models.py files
|Reported by:||George Vilches||Owned by:||Justin Lilly|
|Severity:||Normal||Keywords:||management command sql sqlall|
|Cc:||sanfordarmstrong@…, johann@…, gabehr@…, noah@…, brianz@…, Jari Pennanen, omer.drow@…, hs@…, Silver_Ghost||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When attempting to run python manage.py sql <list_of_apps> (or sqlall, sqlindexes, etc.), if one of the apps listed does not have any models, the command will generate this error.
Error: App with label XXXXX could not be found. Are you sure your INSTALLED_APPS setting is correct?
The solution is to allow emptyOK=True when the models are pulled from each app. (Patch attached).
There are several reasons to create apps that have no models.py, not the least of which is to register more management commands with your project in their own independent app (which you could then include in several other projects). Someone trying to automate the use of the management commands to generate SQL would not be able to determine easily which apps do and do not have models.py, but it is not in any way harmful to just allow emptyOK=True, as all other app errors will still be caught, and the output does not change in any way before or after the patch.
Change History (38)
comment:1 Changed 9 years ago by
|Triage Stage:||Unreviewed → Design decision needed|
comment:8 Changed 7 years ago by
|Summary:||manage.py sql/sqlall/etc. errors on apps without models.py files → manage.py sql/sqlall/test/etc. errors on apps without models.py files|
comment:26 Changed 6 years ago by
|Owner:||changed from Silver_Ghost to anonymous|
|Status:||assigned → new|
comment:29 Changed 6 years ago by
|Owner:||changed from anonymous to Justin Lilly|
|Status:||new → assigned|
comment:30 Changed 6 years ago by
|Summary:||manage.py sql/sqlall/test/etc. errors on apps without models.py files → improved error message on apps without models.py files|
|Triage Stage:||Design decision needed → Ready for checkin|