How to fix-no such table: main.auth_user__old

后端 未结 8 1326
北恋
北恋 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:15

    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.

提交回复
热议问题