django用户身份验证的迁移历史不一致

django用户身份验证的迁移历史不一致,django,authentication,user-accounts,Django,Authentication,User Accounts,我正在做我的第一个django项目,现在我正在尝试添加user\u身份验证。我知道一开始我可能就应该这么做,但现在我正在努力。我还创建了一些其他应用程序,运行良好。但是,当我添加accounts应用程序时,在accounts/models.py中运行迁移时出现以下错误 django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its de

我正在做我的第一个django项目,现在我正在尝试添加
user\u身份验证。我知道一开始我可能就应该这么做,但现在我正在努力。我还创建了一些其他应用程序,运行良好。但是,当我添加accounts应用程序时,在accounts/models.py中运行迁移时出现以下错误

django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency accounts.0001_initial on database 'default'.

我删除了除“auth_user”之外的所有表,并再次运行“python manage.py makemigrations myapp”“python manage.py migrate myapp”


这解决了问题。

在我遇到以下问题的情况下,是什么帮助了我进行迁移:

django.db.utils.ProgrammingError:(1146,“表'mydjango.MyApp_publication'不存在”)

它被视为连接。py如下所示:

  • 运行命令python manage.py
  • 迁移——伪MyApp zero
  • 然后python manage.py迁移MyApp
  • 这里的“MyApp”是您正在Django服务器上创建的应用程序