在它使用mysql
,我有3个应用程序,并在其中的一个我有一个“国家”模型django 1.11
应用:“表不存在” Django上makemigrations
class Country(models.Model):
countryId = models.AutoField(primary_key=True, db_column='country_id')
name = models.CharField(max_length=100)
code = models.CharField(max_length=3)
class Meta:
db_table = 'country'
Whaen我尝试makemigrations
我得到这个错误:
django.db.utils.ProgrammingError: (1146, "Table 'dbname.country' doesn't exist")
如果我在其他应用程序,它是不相关的这个模型,并使用./manage.py makemigrations another_app
的数据库表进行迁移,我仍然得到这个错误。
当模块在创建表之前加载时,您有模块级代码试图从数据库中获取对象。 [这是一个类似的问题](https://stackoverflow.com/questions/45153674/programmingerror-relation-blah-blah-does-not-exist-trying-to-run-the-specifi/45154403#45154403)。完整的回溯会告诉你查找的位置。 – Alasdair