o遗留数据库表信息
MEM_ID MEM_SQ X_AUTH_USER X_AUTH_KEY X_STORAGE_URL ACCESSKEY
o我的应用信息模型 提到https://docs.djangoproject.com/en/dev/howto/legacy-databases/
python manage.py inspectdb
迁移db
python manage.py migrate
我的应用模型
class SsAuthList(models.Model):
mem_id = models.CharField(db_column='MEM_ID', max_length=62, blank=True, null=True) # Field name made lowercase.
mem_sq = models.CharField(db_column='MEM_SQ', max_length=50, blank=True, null=True) # Field name made lowercase.
x_auth_user = models.CharField(db_column='X_AUTH_USER', max_length=59, blank=True, null=True) # Field name made lowercase.
x_auth_key = models.CharField(db_column='X_AUTH_KEY', max_length=50, blank=True, null=True) # Field name made lowercase.
x_storage_url = models.CharField(db_column='X_STORAGE_URL', max_length=71, blank=True, null=True) # Field name made lowercase.
accesskey = models.CharField(db_column='ACCESSKEY', max_length=62, blank=True, null=True) # Field name made lowercase.
答案 0 :(得分:0)
也许问题是你丢失了元类定义:
class SsAuthList(models.Model):
mem_id = models.CharField(db_column='MEM_ID', max_length=62, blank=True, null=True)
mem_sq = models.CharField(db_column='MEM_SQ', max_length=50, blank=True, null=True)
x_auth_user = models.CharField(db_column='X_AUTH_USER', max_length=59, blank=True, null=True)
x_auth_key = models.CharField(db_column='X_AUTH_KEY', max_length=50, blank=True, null=True)
x_storage_url = models.CharField(db_column='X_STORAGE_URL', max_length=71, blank=True, null=True)
accesskey = models.CharField(db_column='ACCESSKEY', max_length=62, blank=True, null=True)
class Meta:
managed = False
db_table = 'TABLE_NAME'