It would be helpful, in `django.db.migrations.state` if we were to
annotate the LookupError with the common issue the user is likely seeing,
something like (on StateApps):
{{{
def get_app_config(self, app_label):
try:
return super(StateApps, self).get_app_config(app_label)
except LookupError as err:
err.args += ('Possibly missing dependency on a migration?', )
raise
}}}
I'm not attached to the particular implementation or wording, just
suggesting that the error message should be cleaner in the migrations-
can't-find-app case, which is different than the general "can't find an
app of that name" case.
--
Ticket URL: <https://code.djangoproject.com/ticket/25616>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:1>
* status: new => assigned
* owner: nobody => tmilan81
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:2>
* has_patch: 0 => 1
Comment:
Created a pull request with a change that implements this:
https://github.com/django/django/pull/5589
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:3>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:4>
* owner: tmilan81 =>
* status: assigned => new
* has_patch: 1 => 0
* needs_tests: 1 => 0
* needs_better_patch: 1 => 0
Comment:
Deassigning due to inactivity. Markus commented on the pull request, "I'd
prefer overriding the `StateApps` class in `django.db.migrations.state` to
catch the `LookupError` and reraise with an amended message."
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:5>
* status: new => assigned
* owner: => soon
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:6>
* status: assigned => new
* cc: 0coming.soon@… (added)
* owner: soon =>
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:7>
* status: new => assigned
* owner: => andersonresende
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:8>
* owner: andersonresende =>
* status: assigned => new
* easy: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:9>
* owner: => akki
* status: new => assigned
Comment:
Can anyone please suggest the steps to reproduce this issue, it would be
really helpful.
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:10>
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/6094
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:11>
* needs_tests: 0 => 1
Comment:
We can't commit the patch without a test.
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:12>
* owner: akki =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:13>
* owner: => nip3o
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:14>
* needs_tests: 1 => 0
Comment:
New patch inspired from previous patch, including test:
https://github.com/django/django/pull/6699/
However, I realize that I'm not sure when this actually happens in
practice, which means that the new error message may actually be more
misleading then the old one.
* When trying to migrate model with a reference to an app which is not in
`INSTALLED_APPS`, we will typically get a `SystemCheckError` before the
migration even starts.
* When the app we depend upon is in `INSTALLED_APPS`, but the app is not
included in `dependencies`, we seems to get a `ValueError: Related model
... cannot be resolved`.
* When the name of an app in `dependencies` in the migration file does
not exist, we get a NodeNotFoundError.
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:15>
* needs_better_patch: 0 => 1
Comment:
If in doubt, we could close the ticket as "needsinfo" as we've not
received steps to reproduce the problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:16>
* status: assigned => closed
* resolution: => needsinfo
--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:17>