报错django.db.migrations.exceptions.InconsistentMigrationHistory
Pycharm强大的功能总是让我很是着迷,比如它的makemigrations 和 migrate。
然而某一次,当我再次敲下这熟悉的命令时,它报错了。。。。
Traceback (most recent call last):
File "H:\PyCharm 2018.1.1\helpers\pycharm\django_manage.py", line 52, in <module>
run_command()
File "H:\PyCharm 2018.1.1\helpers\pycharm\django_manage.py", line 46, in run_command
run_module(manage_file, None, '__main__', True)
File "h:\python36\Lib\runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "h:\python36\Lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "h:\python36\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "H:/PycharmProjects/untitled\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\core\management\commands\migrate.py", line 82, in handle
executor.loader.check_consistent_history(connection)
File "C:\Users\Administrator\Envs\testvir1\lib\site-packages\django\db\migrations\loader.py", line 291, in check_consistent_history
connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'. Process finished with exit code 1
不想看上边的朋友我还截了个大图。
错误是:django.db.migrations.exceptions.InconsistentMigrationHistory

在试了一些其他方法后,我发现了一个最简单最暴力的解决方案:
就是打开Navicat,把所有表删掉之后,再次输入 migrate ,回车,就OK了~~~

报错django.db.migrations.exceptions.InconsistentMigrationHistory的更多相关文章
- 使用django执行数据更新命令时报错:django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.00 01_initial on database 'default'.
如果在重新封装更新用户表之前,已经更新了数据表,在数据库中已经有了django相关的依赖表,就会报错: django.db.migrations.exceptions.InconsistentMigr ...
- django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applie
Traceback (most recent call last): File "manage.py", line 15, in <module> execute_fr ...
- 替换django的user模型出现的异常django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applie ...
- django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
1.使用Python3.7 + Django2.2 + MySQL 5.5 在执行(python manage.py migrate)命令时出现错误django.db.migrations.excep ...
- django.db.migrations.exceptions.BadMigrationError: Migration tests in app bl
这个错误基本上都是 替换文件后才会出现的问题 因为你替换后他的日志文件没有完全替换的话,那么日志对应不到就会出现这样的问题, 一个模糊的处理办法:重新进行数据迁移:首先删除migrations中除去_ ...
- django 保存中文到mysql 报错django.db.utils.DatabaseError: Incorrect string value: '\xE5\xBE\x88\xE7\x81\xB5
分析: 1.尝试在Python中对数据转码成utf8,'中文'.encode("utf-8"),还是报错 2.观察堆栈发现应该是操作mysql数据库的时候,将数据插入表里出错 所以 ...
- 迁移文件是报错 django.db.utils.InternalError: (1054, "Unknown column 'name' in 'django_content_type'")
相信大家在做django迁移时有可能会遇到这样的错误- django.db.utils.InternalError: (1054, “Unknown column ‘name’ in ‘django_ ...
- 【Python + Selenium】初次用IE浏览器之报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.
初次用IE浏览器运行自动化程序时,报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launchi ...
- 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure
报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...
随机推荐
- grep -vFf 比较2个文件差异
grep -vFf 1.txt 2.txt 打印出2.txt中与1.txt有差异的数据. #cat .txt 192.168.0.1 192.168.0.2 192.168.0.3 #cat .t ...
- Spring学习笔记(1)
激发pojo的潜能,不会让pojo类继承实现或导入与Spring API相关的任何东西 那么spring怎么装配pojo呢-------->依赖注入(最大好处:松耦合) 耦合具有两面性: 一方面 ...
- C语言第二次博客作业—分支结构
一.PTA实验作业 题目1:计算分段函数 1.实验代码 double x,y; scanf("%lf",&x); if(x>=0){ y=sqrt(x); print ...
- 201621123044《JAVA程序设计》第一周学习总结
1. 本周学习总结 1.了解了JAVA的诞生以及发展历史简介.JAVA语言的特点,以及JAVA的电脑安装以及环境配置. 2.JAVA不仅可以用eclipse进行编写,也可以在记事本和notepad++ ...
- PYTHON 词云
#!/usr/bin/env python # -*- coding:utf-8 -*- import matplotlib.pyplot as plt from wordcloud import W ...
- 在arc模式下 CGImage 释放问题
//大图bigImage //定义myImageRect,截图的区域 if (imagecount >= 3) { CGRect myImageRect; if (i.size.width< ...
- hdu 4553 约会安排
约会安排 http://acm.hdu.edu.cn/showproblem.php?pid=4553 Time Limit: 2000/1000 MS (Java/Others) Memory ...
- velocity学习总结
什么是velocity velocity是一个基于Java的模板引擎,它可以实现彻底的前后端,前端不允许像jsp那样出现Java代码,而是利用context容器传递变量,在java代码里面我们可以往容 ...
- Node入门教程(5)第四章:global 全局变量
global - 全局变量 全局对象(global object),不要和 全局的对象( global objects )或称标准内置对象混淆.这里说的全局的对象是说在全局作用域里的内的对象.全局作用 ...
- JAVA_SE基础——24.面向对象的内存分析
黑马程序员入学blog ... 接着上一章的代码: //车类 class Car{ //事物的公共属性使用成员变量描述. String name; //名字的属性 String color; //颜色 ...