执行migrate报错:django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency blog. 0001_initial on database 'default'.

报错

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

报错原因

在数据库中已经有了django相关的依赖表

解决

ps: 慎用该方法,我这里是刚新建数据库,内无数据

  1. MySQL删除相应数据库(如:django_bbs)
drop database django_bbs;
  1. MySQL中新建数据库
create database django_bbs;
  1. pycharm中重新执行migrate
python manage.py migrate
posted @ 2022-09-16 20:18  梦想有双休  阅读(109)  评论(0编辑  收藏  举报