No such table: main.auth_user__old

Doing the Python Programming for Developers course. Ran into issue video 9 Customizing the Admin in 10- Building Web Applications with Django (115m).

Upon trying to add a new genre to the DB getting error:

OperationalError at /admin/movies/genre/add/

no such table: main.auth_user__old

any help would be appreciated.

Thank you,

1 Like

You have to install the latest version of Django. You cannot go by the version the Mosh installed in the course.

OperationalError at /admin/information/accounts/add/

no such table: main.auth_user__old

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/information/accounts/add/
Django Version: 3.1.6
Exception Type: OperationalError
Exception Value: no such table: main.auth_user__old
Exception Location: C:\Users\sukhb\PycharmProjects\accounts\venv\lib\site-packages\django\db\backends\sqlite3\base.py, line 413, in execute
Python Executable: C:\Users\sukhb\PycharmProjects\accounts\venv\Scripts\python.exe
Python Version: 3.9.0
Python Path: [‘C:\Users\sukhb\PycharmProjects\accounts’, ‘C:\Users\sukhb\AppData\Local\Programs\Python\Python39\python39.zip’, ‘C:\Users\sukhb\AppData\Local\Programs\Python\Python39\DLLs’, ‘C:\Users\sukhb\AppData\Local\Programs\Python\Python39\lib’, ‘C:\Users\sukhb\AppData\Local\Programs\Python\Python39’, ‘C:\Users\sukhb\PycharmProjects\accounts\venv’, ‘C:\Users\sukhb\PycharmProjects\accounts\venv\lib\site-packages’]
Server time: Wed, 17 Feb 2021 07:47:13 +0000

I AM ALSO FACING THE SAME PROBLEM PLEASE HELP

1 Like

``Steps to fix:

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.

9 Likes

thank you!! it works!!

no such table: main.auth_user__old
got this error when following the course of mosh. I referred to the answers of the previous people who have got this so I installed the new version of Django and it still didn’t work. pls give me a hand!! Im stuck…

Please update django, THEN delete db.sqlite3 and do all the db mirgation all again and run it. Only delete the db.sqlite3 AFTER you upgrade the django

1 Like

Please update django, THEN delete db.sqlite3 and do all the db mirgation all again and run it. Only delete the db.sqlite3 AFTER you upgrade the django

Thanks a lot,
this totally worked for me. I installed the old and reinstalled the new version first and then deleted db.sqlite3, but the rest worked just fine. Thank you!

man thanks you saved me a lot of time

thank you…you saved my searching time.

Also had this problem just now in the course. For me it took 10 minutes to copy the code to a new project with the latest version of Django in it. Simple solution, didn’t need to delete anything.

Hi, I have tried everything mentioned in this forum and it still does not work for me. Can someone please help?

no such table: main.auth_user__old

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/products/product/add/
Django Version: 4.1.2
Exception Type: OperationalError
Exception Value: no such table: main.auth_user__old
Exception Location: C:\Users\91971\OneDrive\Desktop\Python projects\pyshop\venv\lib\site-packages\django\db\backends\sqlite3\base.py, line 357, in execute
Raised during: django.contrib.admin.options.add_view
Python Executable: C:\Users\91971\OneDrive\Desktop\Python projects\pyshop\venv\Scripts\python.exe
Python Version: 3.10.7
Python Path: [‘C:\Users\91971\OneDrive\Desktop\Python projects\pyshop’, ‘C:\Users\91971\AppData\Local\Programs\Python\Python310\python310.zip’, ‘C:\Users\91971\AppData\Local\Programs\Python\Python310\DLLs’, ‘C:\Users\91971\AppData\Local\Programs\Python\Python310\lib’, ‘C:\Users\91971\AppData\Local\Programs\Python\Python310’, ‘C:\Users\91971\OneDrive\Desktop\Python projects\pyshop\venv’, 'C:\Users\91971\OneDrive\Desktop\Python ’ ‘projects\pyshop\venv\lib\site-packages’]
Server time: Mon, 10 Oct 2022 06:14:25 +0000

Actually, it has worked now :face_holding_back_tears:. I was deleting DB Sqllite (software) rather than deleting the DB.Sqlite3 file that Python / Django creates :face_with_hand_over_mouth:

it works thank you!

for people wondering it also works in version 4.2