Django没有从模型生成数据库表

时间:2017-10-02 17:58:48

标签: python django

我的项目包含一些应用。 像:

MainProject
|---- client
      |----models.py

我试图生成我client/models.py

中的模型

模型如下:

class Client(models.Model):
    name = models.TextField()
    lastname = models.TextField()
    picture = models.TextField(blank=True, null=True)
    active = models.BooleanField()
    created_at = models.DateTimeField()
    registeredlanguage = models.TextField()
    id_language = models.ForeignKey('Language', models.DO_NOTHING, db_column='id_language')
    email = models.TextField()
    phone = models.TextField(blank=True, null=True)
    id_gender = models.ForeignKey('Gender', models.DO_NOTHING, db_column='id_gender')
    birthdate = models.TextField(blank=True, null=True)
    facebookid = models.BigIntegerField(blank=True, null=True)

    class Meta:
        #managed = False
        db_table = 'client'

模型是在之前的项目中生成的(几年前),现在当我再次尝试生成表时,会生成任何表。 如何将项目中的模型应用到我的数据库中?

# python manage.py showmigrations

account
 (no migrations)
admin
 [ ] 0001_initial
 [ ] 0002_logentry_remove_auto_add
api
 (no migrations)
auth
 [ ] 0001_initial
 [ ] 0002_alter_permission_name_max_length
 [ ] 0003_alter_user_email_max_length
 [ ] 0004_alter_user_username_opts
 [ ] 0005_alter_user_last_login_null
 [ ] 0006_require_contenttypes_0002
 [ ] 0007_alter_validators_add_error_messages
 [ ] 0008_alter_user_username_max_length
catalog
 (no migrations)
client
 [ ] 0001_initial

另外

# python manage.py makemigrations
No changes detected
# python manage.py makemigrations client
No changes detected in app 'client'

0 个答案:

没有答案