Django - DatabaseError: No such table

前端 未结 5 830
不知归路
不知归路 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:39

    Actually the problem was that the table never got created. Since I am fairly new with django, I did not know that ./manage.py syncdb does not update existing models, but only creates the ones that do not exist.

    Because the model 'Server' existed before I added the other model, and it was already in the db, 'syncdb' did not actually create the new tables.

提交回复
热议问题