Django

Code

Ticket #7198 (new)

Opened 3 days ago

manage.py sql/sqlall/etc. errors on apps without models.py files

Reported by: gav Assigned to: nobody
Component: Core framework Version: SVN
Keywords: management command sql sqlall Cc:
Triage Stage: Unreviewed Has patch: 1
Needs documentation: Needs tests:
Patch needs improvement:

Description

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.

Attachments

sql_no_models_r7520.patch (0.7 kB) - added by gav on 05/08/08 13:20:29.
Patch to allow management commands against apps with no models, against r7520

Change History

05/08/08 13:20:29 changed by gav

  • attachment sql_no_models_r7520.patch added.

Patch to allow management commands against apps with no models, against r7520


Add/Change #7198 (manage.py sql/sqlall/etc. errors on apps without models.py files)




Change Properties
Action