Burgesszheng 2020-05-30
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database ‘default‘. 问题分析,在配置中设置了 AUTH_USER_MODEL = ‘user.User‘ (应用名.模型类名),扩展django自带的user认证.由于不是项目的第一次迁移,所以会产生此问题,解决方案如下: 注释掉两个地方: INSTALLED_APPS = [ ... #‘django.contrib.admin‘, ... ] path(‘admin/‘, admin.site.urls) 执行python manage.py migrate,解决! 取消注释后续makemigrations、migrate全部正常