#29506: Misleading migrate "App 'apps.somethings' does not have migrations."
error
message with nested apps
-------------------------------------+-------------------------------------
Reporter: oliver | Owner: nobody
Type: Bug | Status: new
Component: Core | Version: master
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If you have a couple of nested apps, or apps that are not available
directly in the top-level namespace and you use migrate command, and pass
the full dotted path to this command, the error message is somewhat
misleading:
{{{
CommandError: App 'apps.somethings' does not have migrations.
}}}
In this case, the somethings app have migrations, but migrate command
expecting just app_label.
And there is the other misleading error message.
If you use migrate command and pass nonexistent app in your INSTALLED_APP,
the error message is somewhat misleading:
{{{
CommandError: App 'nonexistent_app' does not have migrations.
}}}
In this case, the nonexistent_app does not exist, but the error message
make user think that nonexistent app just don't have migrations.
Currently, makemigrations command check for existence and validity of app.
As follows
{{{
# Make sure the app they asked for exists
app_labels = set(app_labels)
bad_app_labels = set()
for app_label in app_labels:
try:
apps.get_app_config(app_label)
except LookupError:
bad_app_labels.add(app_label)
if bad_app_labels:
for app_label in bad_app_labels:
if '.' in app_label:
self.stderr.write(
"'%s' is not a valid app label. Did you mean
'%s'?" % (
app_label,
app_label.split('.')[-1],
)
)
else:
self.stderr.write("App '%s' could not be found. Is it
in INSTALLED_APPS?" % app_label)
sys.exit(2)
}}}
How about checking that in migrate command?
== This ticket is very similar to
https://code.djangoproject.com/ticket/29469.
But it is about migrate not makemigrations.
Please read this ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/29506>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.50c7dc537f8a49bd01def769ac301211%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.