How to fix-no such table: main.auth_user__old

后端 未结 8 1320
北恋
北恋 2021-01-23 08:02

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

8条回答
  •  南方客
    南方客 (楼主)
    2021-01-23 08:19

    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):

    1. close any terminal windows in PyCharm or other 'runserver' instances
    2. delete db.sqlite3

    Then upgrade Django like this in a terminal window pip install --upgrade django==2.1.5 Once it's done, you rebuild.

    1. open a terminal window in PyCharm, type: python manage.py makemigrations and hit enter. It should say no changes detected.
    2. Then type: python manage.py migrate, it'll rebuild db.sqlite3
    3. Then: python manage.py runserver and let that run.
    4. Open a new terminal, type python manage.py createsuperuser and follow prompts.
    5. Open http://127.0.0.1:8000/admin , enter the details you just created, and you're working.

提交回复
热议问题