When I run tests I get this error during database initialization:
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [
I also faced this issue (after doing some complex model inheritance). One of my migrations contained
migrations.CreateModel(
name='Offer',
fields=[
# ...
],
options={
# ...
},
bases=('shop.entity',),
),
I deleted shop.Entity
model entirely, but the migration was referencing it in bases
attribute. So I just deleted bases=('shop.entity',)
and it works. It will probably break an opportunity to migrate from the beginning, but at least allows to migrate further on.
Another advice would be: go directly to django code and inspect what's causing "bases" trouble. Go to django/db/migrations/state.py
and add a breakpoint:
try:
bases = tuple(
(apps.get_model(base) if isinstance(base, six.string_types) else base)
for base in self.bases
)
except LookupError:
print(self.bases) # <-- print the bases
import ipdb; ipdb.set_trace() # <-- debug here
raise InvalidBasesError("Cannot resolve one or more bases from %r" % (self.bases,))