- html - 我的下拉菜单的内容关闭得太快
- c# - 使用 Html Agility Pack 从网页中的表中获取值而不使用 "SelectNode'
- html - 内容容器下的 CSS 下拉菜单
- html - 如何停止嵌套列表重叠父列表?
django.db.utils.InternalError: (1050, “表 'django_content_type' 已经存在”)
我刚刚从我的 friend 那里复制了一个项目,当我运行 makemirations 时,它运行正常。但对于 -
python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, balancesheet, contenttypes, dynapp, pandl2, sessions, trialbal2
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 74, in execute
return self.cursor.execute(query, args)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1050, "Table 'django_content_type' already exists")
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
fake_initial=fake_initial,
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/migrations/operations/models.py", line 92, in database_forwards
schema_editor.create_model(model)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 307, in create_model
self.execute(sql, params or None)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute
cursor.execute(sql, params)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 74, in execute
return self.cursor.execute(query, args)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/home/hostbooks/django1/myproject/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists")
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists")
mysql> drop table django_content_type;
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
最佳答案
对于 Django3:
我收到此错误:
django.db.utils.OperationalError: (1054, “'django_content_type' 中的未知列 'name'”)
Delete * from django_migrations
python3 manage.py makemigrations
python manage.py makemigrations
python3 manage.py migrate --fake-initial
python manage.py migrate --fake-initial
python3 manage.py migrate --fake-initial
关于python - django.db.utils.InternalError : (1050, "Table ' django_content_type' 已经存在"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59999242/
尝试使用 PyMySQL 版本 0.8.0 从 Python(版本 3.6.5)将数据帧输出到 MySQL 数据库表中。 SQLAlchemy 版本 1.2.17,数据库服务器为 8.0.1。 相同的
我使用 Django,只是删除并重新创建数据库以刷新表数据。现在,当我尝试执行任何与数据库相关的任务时,我得到: ./manage.py sql portfolio Traceback (most r
我在流式传输数据时遇到以下错误: Google.ApisGoogle.Apis.Requests.RequestError Internal Error [500] Errors [ Mes
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我们无法获得此异常的确切原因。有谁知道,为什么这个异常发生在android应用程序中?提前致谢。 这是 Exception 的完整堆栈跟踪: Fatal Exception: java.lang.In
当我查找 javascript 错误类型时,我发现根据 MDN 有 7 种错误类型.我可以生成所有核心五个错误,例如 SyntaxError、ReferenceError、RangeError、URI
我在 heroku 上使用 peewee,但根据 peewee 文档,删除相关表必须在代码中完成。 问题是如何? 我有以下型号 class WebPage(Model): title = Char
经常看到以下崩溃日志弹出: java.lang.InternalError: at java.lang.Thread.nativeCreate (Native Method) at java.
尝试让 Elasticsearch 运行并为 PDF 编制索引。我不熟悉Java。它提示的窗口服务器是什么,我该如何修复它? Jun 13 15:57:23 server.mydomain.com j
在我的应用程序中,我在某些设备上遇到了奇怪的崩溃。我以前从未见过这个错误。这是堆栈跟踪 Non-fatal Exception: java.lang.InternalError: Thread sta
我试图在 Ubuntu 环境中运行一个名为 Orphelia ( http://orphelia.gobics.de/index.jsp ) 的程序,但总是返回相同的 java 错误。 Excepti
我尝试运行以下图表: 不幸的是,我收到以下错误消息: tensorflow.python.framework.errors.InternalError: Message length was nega
我正在编写一个函数,可以将新表添加到我的数据库中。我遇到的问题是当表已经存在时我收到错误消息: pymysql.err.InternalError: (1050, "Table 'doesthiswo
我收到此错误: java.lang.InternalError: name is too long to represent at java.lang.ClassLoader.defi
我正尝试使用此 link 从 Tensorflow Hub 微调 Google Colab 上的 BERT 模型. 但是,我遇到了以下错误: InternalError: RET_CHECK fail
我想使用 raspberrypi 中的 python 连接 MySQL RDS DB。(我想使用 select 查询从 MySQL 表'face'中获取 seq。) 我有一个错误,但我无法修复它。 这
我是 Python 和 MySQL 新手,所以我正在使用只读帐户进行练习。我正在尝试创建一个可执行脚本,该脚本基本上要求提供名字、姓氏,然后将它们插入查询并返回结果。以下是我所拥有的以及我收到的错误:
从phone_number返回用户ID GET_USER_ID = "SELECT user_id FROM user WHERE phone_number = {};" 我尝试运行上述查询并收到此错
x = float(stand[1].split(' ')[0]) y = float(stand[1].split(' ')[1]) coordinate = ppy
当我尝试执行 SVN 同步时,出现了这个错误。我想知道为什么会这样,有什么想法吗?重新启动 Eclipse 后它工作得很好,但我想知道是什么原因导致它以及找不到 jar 的可能性。 !ENTRY or
我是一名优秀的程序员,十分优秀!