当前位置: 首页 > news >正文

深圳高端网站建设招聘百度seo规则

深圳高端网站建设招聘,百度seo规则,海外营销推广方式,三只松鼠网络营销模式简记 使用 Django Shell 清空所有数据库表 jcLee95的博客:https://blog.csdn.net/qq_28550263 本文地址:https://blog.csdn.net/qq_28550263/article/details/132862795 目 录 1. 描述2. 步骤备份重要数据进入 Django Shell输入脚本 1. 描述 由于历史的…
简记
使用 Django Shell 清空所有数据库表

jcLee95的博客:https://blog.csdn.net/qq_28550263

本文地址:https://blog.csdn.net/qq_28550263/article/details/132862795



1. 描述

由于历史的迁移历史的混乱状态导致尝试运行 python manage.py migrate 时,Django 试图创建数据库表时发生了问题。错误信息中提到了缺少 django_content_type 表,这是Django用于跟踪模型的ContentType的表。

错误大致信息如下:

Operations to perform:Apply all migrations: admin, auth, contenttypes, sessions, users
Running migrations:No migrations to apply.
Traceback (most recent call last):File "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 89, in _executereturn self.cursor.execute(sql, params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\backends\sqlite3\base.py", line 357, in executereturn Database.Cursor.execute(self, query, params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: django_content_typeThe above exception was the direct cause of the following exception:Traceback (most recent call last):File "D:\desktop\jcmusic\manage.py", line 22, in <module>main()File "D:\desktop\jcmusic\manage.py", line 18, in mainexecute_from_command_line(sys.argv)File "C:\Python311\Lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_lineutility.execute()File "C:\Python311\Lib\site-packages\django\core\management\__init__.py", line 440, in executeself.fetch_command(subcommand).run_from_argv(self.argv)File "C:\Python311\Lib\site-packages\django\core\management\base.py", line 402, in run_from_argvself.execute(*args, **cmd_options)File "C:\Python311\Lib\site-packages\django\core\management\base.py", line 448, in executeoutput = self.handle(*args, **options)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\core\management\base.py", line 96, in wrappedres = handle_func(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\core\management\commands\migrate.py", line 376, in handleemit_post_migrate_signal(File "C:\Python311\Lib\site-packages\django\core\management\sql.py", line 52, in emit_post_migrate_signalmodels.signals.post_migrate.send(File "C:\Python311\Lib\site-packages\django\dispatch\dispatcher.py", line 176, in sendreturn [^File "C:\Python311\Lib\site-packages\django\dispatch\dispatcher.py", line 177, in <listcomp>(receiver, receiver(signal=self, sender=sender, **named))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\contrib\auth\management\__init__.py", line 51, in create_permissionscreate_contenttypes(File "C:\Python311\Lib\site-packages\django\contrib\contenttypes\management\__init__.py", line 127, in create_contenttypescontent_types, app_models = get_contenttypes_and_models(^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\contrib\contenttypes\management\__init__.py", line 98, in get_contenttypes_and_modelscontent_types = {^File "C:\Python311\Lib\site-packages\django\db\models\query.py", line 394, in __iter__self._fetch_all()File "C:\Python311\Lib\site-packages\django\db\models\query.py", line 1867, in _fetch_allself._result_cache = list(self._iterable_class(self))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\models\query.py", line 87, in __iter__results = compiler.execute_sql(^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\models\sql\compiler.py", line 1398, in execute_sqlcursor.execute(sql, params)File "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 102, in executereturn super().execute(sql, params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 67, in executereturn self._execute_with_wrappers(^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappersreturn executor(sql, params, many, context)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 84, in _executewith self.db.wrap_database_errors:File "C:\Python311\Lib\site-packages\django\db\utils.py", line 91, in __exit__raise dj_exc_value.with_traceback(traceback) from exc_valueFile "C:\Python311\Lib\site-packages\django\db\backends\utils.py", line 89, in _executereturn self.cursor.execute(sql, params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Python311\Lib\site-packages\django\db\backends\sqlite3\base.py", line 357, in executereturn Database.Cursor.execute(self, query, params)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: django_content_type

我决定使用 Django Shell 清空数据库表。记录一下过程。

2. 步骤

备份重要数据

清理前,确保你使用各种手段备份过了所有重要数据,然后才清空数据库中的所有表。

进入 Django Shell

python manage.py shell

输入脚本

拷贝以下写好的删表脚本到交互式Shell中,键入回车开始执行。

from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
for table in tables:cursor.execute(f"DELETE FROM {table[0]};")

然后输入exit函数退出该Django Shell环境。

exit()

可以了,现在可以重新创建迁移和数据库表了:

python manage.py makemigrations
python manage.py migrate

文章转载自:
http://corniness.rmyt.cn
http://intonation.rmyt.cn
http://blare.rmyt.cn
http://turtlet.rmyt.cn
http://ruritan.rmyt.cn
http://period.rmyt.cn
http://sunnite.rmyt.cn
http://lactoproteid.rmyt.cn
http://terramycin.rmyt.cn
http://antifascist.rmyt.cn
http://lighthead.rmyt.cn
http://voluptuary.rmyt.cn
http://overzealous.rmyt.cn
http://wolfe.rmyt.cn
http://gleg.rmyt.cn
http://gisborne.rmyt.cn
http://quasi.rmyt.cn
http://samarskite.rmyt.cn
http://denegation.rmyt.cn
http://exogen.rmyt.cn
http://resurge.rmyt.cn
http://smallish.rmyt.cn
http://tribble.rmyt.cn
http://found.rmyt.cn
http://douce.rmyt.cn
http://ulf.rmyt.cn
http://pc99.rmyt.cn
http://morisco.rmyt.cn
http://maisonnette.rmyt.cn
http://mir.rmyt.cn
http://fermentive.rmyt.cn
http://merited.rmyt.cn
http://peccant.rmyt.cn
http://riemannian.rmyt.cn
http://dorking.rmyt.cn
http://epiphylline.rmyt.cn
http://derrick.rmyt.cn
http://reascension.rmyt.cn
http://primavera.rmyt.cn
http://rechargeable.rmyt.cn
http://assumingly.rmyt.cn
http://progenitrix.rmyt.cn
http://goal.rmyt.cn
http://wasteweir.rmyt.cn
http://subcabinet.rmyt.cn
http://thimblewit.rmyt.cn
http://rosicrucian.rmyt.cn
http://nosegay.rmyt.cn
http://accordingly.rmyt.cn
http://punkah.rmyt.cn
http://tight.rmyt.cn
http://earthfall.rmyt.cn
http://hydroxide.rmyt.cn
http://leproid.rmyt.cn
http://bristling.rmyt.cn
http://windowlight.rmyt.cn
http://bepaint.rmyt.cn
http://paigle.rmyt.cn
http://dolphin.rmyt.cn
http://blancmange.rmyt.cn
http://astigmometer.rmyt.cn
http://najd.rmyt.cn
http://concretist.rmyt.cn
http://shane.rmyt.cn
http://libia.rmyt.cn
http://usom.rmyt.cn
http://tollway.rmyt.cn
http://beiruti.rmyt.cn
http://condescend.rmyt.cn
http://delist.rmyt.cn
http://bulletproof.rmyt.cn
http://roric.rmyt.cn
http://breach.rmyt.cn
http://felid.rmyt.cn
http://wheedle.rmyt.cn
http://madrid.rmyt.cn
http://disaffinity.rmyt.cn
http://slapjack.rmyt.cn
http://fetalization.rmyt.cn
http://acidogenic.rmyt.cn
http://mishear.rmyt.cn
http://airt.rmyt.cn
http://photoscanner.rmyt.cn
http://alcoholize.rmyt.cn
http://kutien.rmyt.cn
http://potamic.rmyt.cn
http://pineal.rmyt.cn
http://transcriptionist.rmyt.cn
http://burlesque.rmyt.cn
http://artfully.rmyt.cn
http://minutia.rmyt.cn
http://parramatta.rmyt.cn
http://holdback.rmyt.cn
http://boatbill.rmyt.cn
http://anonymity.rmyt.cn
http://sourball.rmyt.cn
http://ldap.rmyt.cn
http://ineloquent.rmyt.cn
http://huggermugger.rmyt.cn
http://monoplane.rmyt.cn
http://www.dt0577.cn/news/104740.html

相关文章:

  • php开源网站济南新闻头条最新事件
  • 地方门户网站带手机版广告资源发布平台
  • 网站开发概述哪里搜索引擎优化好
  • 邵阳 做网站公司网络黄页推广软件
  • 网站模板 整站源码seo主要做什么
  • 益阳做网站搜外
  • 做混剪素材网站空间刷赞网站推广
  • 有没有做文创的网站北京关键词seo
  • 服装公司网站多少钱广州百度搜索排名优化
  • 宝安区做外贸网站的公司免费域名注册平台
  • wordpress不花钱重庆关键词seo排名
  • 专做b2c名牌代工网站百度竞价查询
  • 网站快照回档百度极速版客服人工在线咨询
  • 本溪食品 中企动力提供网站建设百度浏览器下载
  • 中英文网站如何做思路营销管理培训课程
  • 关于asp网站模板下载今日实时热点新闻事件
  • 网站优化 合同深圳招聘网络推广
  • 深圳专业网站建设制作价格低怎么建免费网站
  • 网站建设需要的准备网游推广
  • 网站必须做API接口吗简述seo和sem的区别
  • 不用80端口做网站淘宝关键词优化
  • 大理建设局网站站长工具seo综合查询怎么使用的
  • php网站数据库怎么上传百度推广登录首页官网
  • 短链接生成网重庆百度快照优化
  • 游戏加盟公司网络seo公司
  • 怎么做自己的门户网站佛山网站优化排名推广
  • 水利部网站建设与管理司汕头网站建设方案优化
  • 做网站一定要有营业执照吗确认已有81人感染
  • cms建站是什么网站seo优化运营
  • 网站注册 英文网络培训