InvalidBasesError: Cannot resolve bases for []

后端 未结 14 961
遥遥无期
遥遥无期 2021-02-03 23:03

When I run tests I get this error during database initialization:

django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [

        
14条回答
  •  日久生厌
    2021-02-03 23:30

    Simply creating a migrations directory at the root of your app (so users/migrations/ in your case) and adding an empty __init__.py file might resolve your issue. At least it did for me when I was getting the same error.

    But you're better off running makemigrations for your app, as suggested by @zenofewords above. That will create the directory for you AND generate migrations for your proxy models.

    Why does Django create migration files for proxy models?

    Your tests are looking for those migrations and aren't finding them.

提交回复
热议问题