Django - DatabaseError: No such table

前端 未结 5 832
不知归路
不知归路 2021-02-04 11:12

I defined two models:

class Server(models.Model):
    owners = models.ManyToManyField(\'Person\')

class Person(models.Model):
    name = models.CharField(max_le         


        
5条回答
  •  温柔的废话
    2021-02-04 11:44

    1. use "manage.py help" to check the command
    2. if you find migrate and makemigration, it means your python has updated

    step 1:

    python manage.py makemigration
    

    result 1:

    Migrations for 'mainsite':
    mainsite\migrations\0001_initial.py
    - Create model Post
    

    step 2:

    python manage.py migrate
    

    result 2:

    Operations to perform:
    Apply all migrations: admin, auth, contenttypes, mainsite, sessions
    Running migrations:
    Applying mainsite.0001_initial... OK
    

    finally, runserver. Done

提交回复
热议问题