Answer the question
In order to leave comments, you need to log in
Why is there a "no such table: main.auth_user__old" error?
Hi I'm trying to learn django and am in the process of adding a test "product" in admin mode.
Went to 127.0.0.1:8000/admin further under the Products section that I created earlier in admin.py
from django.contrib import admin
from .models import Product
admin.site.register(Product)
class Offer(models.Model):
code = models.CharField(max_length=10)
description = models.CharField(max_length=255)
discount = models.FloatField()
OperationalError at /admin/products/product/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/products/product/add/
Django Version: 2.1
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: C:\Users\dmitr\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable: C:\Users\dmitr\PycharmProjects\PyShop\venv\Scripts\python.exe
Python Version: 3.7.4
Python Path:
['C:\\Users\\dmitr\\PycharmProjects\\PyShop',
'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
'C:\\Users\\dmitr\\AppData\\Local\\Programs\\Python\\Python37-32',
'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv',
'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages',
'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages\\setuptools-39.1.0-py3.7.egg',
'C:\\Users\\dmitr\\PycharmProjects\\PyShop\\venv\\lib\\site-packages\\pip-10.0.1-py3.7.egg']
Server time: Sat, 23 May 2020 22:35:43 +0000
python manage.py migrate
python manage.py makemigrations
python manage.py migrate
Answer the question
In order to leave comments, you need to log in
All that was needed was:
On the advice of various people, upgrade django to 2.1.5
Delete the SQLite database (you can just manually delete from the project)
Migrate again and then
Restart
DONE! pip install django==2.1.5
They say correctly on the stack, you need to enter your instructions using migrations into the database.
You need to read about them in your native documentation , and / or find a translation into Russian. They [translations] are.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question