/admin/products/product/add/处的OperationalError没有此表:main.auth_user__old [英] OperationalError at /admin/products/product/add/ no such table: main.auth_user__old

查看:137
本文介绍了/admin/products/product/add/处的OperationalError没有此表:main.auth_user__old的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Django上编辑项目,所以我删除了 pychache migrations db.sqlite3 ,并创建了一个新的超级用户登录到管理页面.创建产品并在管理页面上按保存"后,出现错误消息"/admin/products/product/add/处没有操作表:main.auth_user__old".我尝试使用解决方案来解决此问题,例如重新安装Django 2.0.7并再次进行 makemigrations migrate ,但是到目前为止,我尝试过的所有解决方案都没有奏效.有谁知道可能的解决方案?

I was editing a project on Django, so I deleted my pychache, migrations, and db.sqlite3 and created a new superuser to log into the admin page. After I created a product and pressed 'Save' on the admin page an error saying "OperationalError at /admin/products/product/add/ no such table: main.auth_user__old" appeared. I have tried solving this issue with solutions such as reinstalling Django 2.0.7 and doing makemigrations and migrate again, but none of the solutions I have tried have worked so far. Does anyone know of a possible solution to this?

推荐答案

解决方案:升级到最新的Django版本(至少3.1.7)

Solution: Upgrade to latest Django version (at least 3.1.7)

修复步骤:

  • 停止运行django网络服务器,Ctrl-C
  • 删除 db.sqlite3
  • 未安装Django旧版本
  • 使用 pip install django 安装最新版本的Django或此最新版本3.1.7
  • 问题 python manage.py makemigrations
  • 问题 python manage.py migration
  • 使用 python manage.py createsuperuser
  • 创建超级用户
  • 发布 python manage.py runserver (或端口8080)
  • 导航到 http://127.0.0.1:8000/admin/
  • 您将能够成功手动添加表格.
  • Stopped the django webserver running, Ctrl-C
  • Delete the db.sqlite3
  • Uninstalled Django old verison
  • Install latest version of Django with pip install django or this latest version 3.1.7
  • Issue python manage.py makemigrations
  • Issue python manage.py migrate
  • Create a superuser with python manage.py createsuperuser
  • Issue python manage.py runserver (or port 8080)
  • Navigate to http://127.0.0.1:8000/admin/
  • You will successfully able to add table manually.

这篇关于/admin/products/product/add/处的OperationalError没有此表:main.auth_user__old的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆