[Django] #25616: Add note regarding missing dependencies on LookupError for migrations

17 views
Skip to first unread message

Django

unread,
Oct 27, 2015, 10:39:38 AM10/27/15
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+--------------------
Reporter: mcfletch | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+--------------------
If you have a product package that includes migrations which depend on a
plugin package, and you forget to include a dependency on the migration,
you wind up with a confusing error message (raised from
Apps.get_app_config):
{{{
LookupError("No installed app with label '%s'"%(label,))
}}}
where label is the name of the "missing" app. Which then leads the user to
trying to figure out why the app, which is in settings.py is not showing
up.

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.

Django

unread,
Oct 27, 2015, 10:47:48 AM10/27/15
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------

Reporter: mcfletch | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:1>

Django

unread,
Nov 7, 2015, 10:03:09 AM11/7/15
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: tmilan81
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by tmilan81):

* status: new => assigned
* owner: nobody => tmilan81


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:2>

Django

unread,
Nov 7, 2015, 10:22:05 AM11/7/15
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: tmilan81
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by tmilan81):

* 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>

Django

unread,
Nov 8, 2015, 3:29:36 AM11/8/15
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: tmilan81
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by MarkusH):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:4>

Django

unread,
Jan 4, 2016, 7:48:04 PM1/4/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner:

Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Jan 5, 2016, 1:52:20 AM1/5/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: soon
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by soon):

* status: new => assigned

* owner: => soon


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:6>

Django

unread,
Jan 7, 2016, 2:15:25 AM1/7/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner:

Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by soon):

* status: assigned => new
* cc: 0coming.soon@… (added)
* owner: soon =>


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:7>

Django

unread,
Jan 9, 2016, 8:22:56 AM1/9/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
-------------------------------------+-------------------------------------
Reporter: mcfletch | Owner:
Type: | andersonresende
Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by andersonresende):

* status: new => assigned

* owner: => andersonresende


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:8>

Django

unread,
Feb 5, 2016, 5:56:47 PM2/5/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner:

Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* owner: andersonresende =>


* status: assigned => new

* easy: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:9>

Django

unread,
Feb 5, 2016, 7:23:06 PM2/5/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: akki
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by akki):

* 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>

Django

unread,
Feb 7, 2016, 7:24:24 AM2/7/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: akki
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by akki):

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/6094

--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:11>

Django

unread,
Feb 8, 2016, 7:34:40 AM2/8/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: akki
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_tests: 0 => 1


Comment:

We can't commit the patch without a test.

--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:12>

Django

unread,
Feb 12, 2016, 1:07:59 PM2/12/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner:

Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by akki):

* owner: akki =>


* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:13>

Django

unread,
Jun 2, 2016, 2:46:04 PM6/2/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: nip3o
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by nip3o):

* owner: => nip3o


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:14>

Django

unread,
Jun 2, 2016, 7:04:46 PM6/2/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: nip3o
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by nip3o):

* 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>

Django

unread,
Jun 3, 2016, 12:59:48 PM6/3/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
--------------------------------------+------------------------------------
Reporter: mcfletch | Owner: nip3o
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Sep 16, 2016, 9:12:27 PM9/16/16
to django-...@googlegroups.com
#25616: Add note regarding missing dependencies on LookupError for migrations
-------------------------------------+-------------------------------------
Reporter: mcfletch | Owner: nip3o
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: master
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: assigned => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/25616#comment:17>

Reply all
Reply to author
Forward
0 new messages