Can someone give a detailed explanation on how to fix the ERROR: no such table: main.auth_user__old
It arises in my Django application when I am trying to a
If you are using django==2.1 then maybe you getting this error. Just start your Django project again bu installing django==2.1.5 It will work.
I have solved this issue using below :
1) Delete the db.sqlit3
2) app's directory delete everything in pycache
3) manage.py makemigrations, manage.py migrate, manage.py createsuperuser and then manage.py runserver.
You probably haven't run the migrations. Until you run migrations, no tables are created. Hence the error. See https://docs.djangoproject.com/en/2.1/topics/migrations/#workflow
After you've registered your models, go to your git bash or powershell. Make sure you are in your project directory. Then run these commands :
python manage.py makemigrations
And then
python manage.py migrate
These commands will create tables for you and then you can add data to them.
This happened to me as a newbie, whilst following Mosh's intro course on the final project 3: Django. This is the fix, usually using Pycharm or it's equivalent (no need to change any of your code):
Then upgrade Django like this in a terminal window pip install --upgrade django==2.1.5
Once it's done, you rebuild.
python manage.py makemigrations
and hit enter. It should say no changes detected.python manage.py migrate
, it'll rebuild db.sqlite3python manage.py runserver
and let that run.python manage.py createsuperuser
and follow prompts.When I used the python shell to add to database instead of the UI, error did not show anymore
$ python manage.py shell
from AppName.models import Product
Product.objects.create(title='Newer', price=239.99, summary='awesome')
There is no need to downgrade to any version of Django or SQL Lite but if you follow the steps I have outlined in this GitHub link https://github.com/komerela/django_troubleshooting you should be good to go... Once you click on the pdf document labeled "Sorting the SQLITE3 issue step by step solution.pdf"
You're welcome!