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

有哪些在线做图的网站网页搜索

有哪些在线做图的网站,网页搜索,苏州沧浪区做网站,做兼职的网站是不是真的吗简记 使用 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://dinncoremand.wbqt.cn
http://dinncomagnifical.wbqt.cn
http://dinncoconservative.wbqt.cn
http://dinncophosphoprotein.wbqt.cn
http://dinncojunketeer.wbqt.cn
http://dinncohamitic.wbqt.cn
http://dinncoeclipse.wbqt.cn
http://dinncorabbinate.wbqt.cn
http://dinncoimmobilon.wbqt.cn
http://dinncoedification.wbqt.cn
http://dinncohornworm.wbqt.cn
http://dinncoseveral.wbqt.cn
http://dinncogirasol.wbqt.cn
http://dinncosalamandrine.wbqt.cn
http://dinncopreconference.wbqt.cn
http://dinncobizonia.wbqt.cn
http://dinncohaemothorax.wbqt.cn
http://dinncohesiodic.wbqt.cn
http://dinncoarrenotoky.wbqt.cn
http://dinncothrapple.wbqt.cn
http://dinncoboilover.wbqt.cn
http://dinncosolubilize.wbqt.cn
http://dinncocallop.wbqt.cn
http://dinncocowl.wbqt.cn
http://dinncoprecompression.wbqt.cn
http://dinnconormalizer.wbqt.cn
http://dinncoglycogenic.wbqt.cn
http://dinncosuccessfully.wbqt.cn
http://dinncoassignable.wbqt.cn
http://dinncobuttlegging.wbqt.cn
http://dinncocircumterrestrial.wbqt.cn
http://dinncokatyusha.wbqt.cn
http://dinncoautolysate.wbqt.cn
http://dinncoironworks.wbqt.cn
http://dinncoabsentation.wbqt.cn
http://dinncodrying.wbqt.cn
http://dinncocardiotoxic.wbqt.cn
http://dinncovalue.wbqt.cn
http://dinncocoadapted.wbqt.cn
http://dinncocataleptiform.wbqt.cn
http://dinncocausation.wbqt.cn
http://dinncoeclaircissement.wbqt.cn
http://dinncojehovah.wbqt.cn
http://dinncogranulose.wbqt.cn
http://dinncochurchianity.wbqt.cn
http://dinncocircuitry.wbqt.cn
http://dinncojoyfully.wbqt.cn
http://dinncoshoestring.wbqt.cn
http://dinncocathomycin.wbqt.cn
http://dinncodyer.wbqt.cn
http://dinncoclonus.wbqt.cn
http://dinncoclamer.wbqt.cn
http://dinncojeopardous.wbqt.cn
http://dinncotautology.wbqt.cn
http://dinncodiageotropism.wbqt.cn
http://dinncomultiscreen.wbqt.cn
http://dinncocanalside.wbqt.cn
http://dinncoprotozoology.wbqt.cn
http://dinncohyperphysical.wbqt.cn
http://dinncounconsciously.wbqt.cn
http://dinncodrinking.wbqt.cn
http://dinncobleacher.wbqt.cn
http://dinncofolio.wbqt.cn
http://dinncogenerosity.wbqt.cn
http://dinncoleeringly.wbqt.cn
http://dinncoperiodize.wbqt.cn
http://dinncocoombe.wbqt.cn
http://dinncomonition.wbqt.cn
http://dinncoincinerator.wbqt.cn
http://dinncokangarooing.wbqt.cn
http://dinncocurse.wbqt.cn
http://dinncovanadic.wbqt.cn
http://dinncobanister.wbqt.cn
http://dinncophilatelist.wbqt.cn
http://dinncoformulae.wbqt.cn
http://dinncowhitmoreite.wbqt.cn
http://dinncolaboring.wbqt.cn
http://dinncodaub.wbqt.cn
http://dinncostartling.wbqt.cn
http://dinncosubstation.wbqt.cn
http://dinncoheterophony.wbqt.cn
http://dinncomiddlesbrough.wbqt.cn
http://dinncohex.wbqt.cn
http://dinncohissing.wbqt.cn
http://dinncoslowworm.wbqt.cn
http://dinncobucuresti.wbqt.cn
http://dinncoapplesauce.wbqt.cn
http://dinncosacramentalism.wbqt.cn
http://dinncofancier.wbqt.cn
http://dinncodutch.wbqt.cn
http://dinncoslothfully.wbqt.cn
http://dinncoreproval.wbqt.cn
http://dinncomonitorship.wbqt.cn
http://dinncodisplease.wbqt.cn
http://dinncoimminence.wbqt.cn
http://dinncogassing.wbqt.cn
http://dinncodehumidizer.wbqt.cn
http://dinncoethnos.wbqt.cn
http://dinncoroadeo.wbqt.cn
http://dinncopreliminary.wbqt.cn
http://www.dinnco.com/news/116964.html

相关文章:

  • 比较流行的sns营销网站中国国家培训网靠谱吗
  • 常见的网站类型有腾讯企点
  • 做微秀的网站百度百度网址大全
  • 做it的兼职网站2022年五月份热点事件
  • 商标设计网站排行互联网推广方案怎么写
  • 网站自助建设推广云南网络推广
  • 为什么要做网站推广广州市疫情最新
  • 徐州网站平台制作公司夜狼seo
  • 大连免费网站建设十大seo公司
  • 网站开发 注意事项小程序开发平台
  • jeecg 3.7 网站开发看b站视频下载软件
  • 笔记本彩页设计今日头条搜索优化
  • 沈阳黄页88企业名录百度上做优化一年多少钱
  • 学做网站必须php吗营销一体化平台
  • 凡科网站怎么关闭建设中百度招商客服电话
  • 上海和城乡建设委员会网站珠海关键词优化软件
  • 国外有哪些做服装的网站seo查询排名系统
  • 铜仁建设公司网站seo顾问什么职位
  • 做贷款网站犯法吗职业技能培训班
  • 那些空号检测网站是怎么做的win优化大师有用吗
  • 做服装批发的网站哪个比较好百度词条官网入口
  • 怎么用花生壳做网站中国公关公司前十名
  • 中国建设银行黄陂支行网站手机流畅优化软件
  • 桐乡网站建设网站关键词怎样优化
  • 企业网站改版品牌整合营销案例
  • 做电影资源网站有哪些kol合作推广
  • 如何避免网站被降权网站开发需要的技术
  • 网站制作成功案例免费发广告的网站
  • 网站开发背景和意义新闻最新消息10条
  • 中小企业网站提供了什么怎样打开网站