如何解决 django 和 sqlite 的兼容性问题?
How to fix a compatibility problem with django and sqlite?
我试图在我的 Django 管理面板中添加一个项目,但是出现了操作错误。我正在搜索,发现那是一个
兼容性问题。我如何在我的项目中设置其他版本的sqlite3?
我尝试安装其他版本的 sqlite,但没有用。我还搜索了 django 和其他令人高兴的文档,但到目前为止没有。
这是我的项目模型:
class Project(models.Model):
title = models.CharField(max_length=200)
description = models.TextField()
image = models.ImageField() .
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
这是操作错误:
OperationalError at /admin/portfolio/proyect/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/portfolio/proyect/add/
Django Version: 2.0.2
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: /Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 303
Python Executable: /Users/carloseduardoloreshernandez/anaconda3/envs/django2/bin/python
Python Version: 3.7.4
Python Path:
['/Users/carloseduardoloreshernandez/Desktop/Apps/Personal/Python/Django2-Udemy/Web '
'personal/Web-personal-Django2/Backend',
'/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python37.zip',
'/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7',
'/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/lib-dynload',
'/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/site-packages']
Server time: Dom, 15 Sep 2019 10:10:05 +0000
我通过 django 升级解决了这个问题:
pip install django --upgrade
然后迁移:
python manage.py migrate
现在一切正常。
我试图在我的 Django 管理面板中添加一个项目,但是出现了操作错误。我正在搜索,发现那是一个 兼容性问题。我如何在我的项目中设置其他版本的sqlite3?
我尝试安装其他版本的 sqlite,但没有用。我还搜索了 django 和其他令人高兴的文档,但到目前为止没有。
这是我的项目模型:
class Project(models.Model):
title = models.CharField(max_length=200)
description = models.TextField()
image = models.ImageField() .
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
这是操作错误:
OperationalError at /admin/portfolio/proyect/add/ no such table: main.auth_user__old Request Method: POST Request URL: http://127.0.0.1:8000/admin/portfolio/proyect/add/ Django Version: 2.0.2 Exception Type: OperationalError Exception Value:
no such table: main.auth_user__old Exception Location: /Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 303 Python Executable: /Users/carloseduardoloreshernandez/anaconda3/envs/django2/bin/python Python Version: 3.7.4 Python Path:
['/Users/carloseduardoloreshernandez/Desktop/Apps/Personal/Python/Django2-Udemy/Web ' 'personal/Web-personal-Django2/Backend', '/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python37.zip', '/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7', '/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/lib-dynload', '/Users/carloseduardoloreshernandez/anaconda3/envs/django2/lib/python3.7/site-packages'] Server time: Dom, 15 Sep 2019 10:10:05 +0000
我通过 django 升级解决了这个问题:
pip install django --upgrade
然后迁移:
python manage.py migrate
现在一切正常。