为什么没有在数据库中创建迁移?

Why is a Migration not being created in database?

我在 settings.py 中将我的应用程序连接到我的数据库,然后 运行 迁移并创建了我的模型 0001_initial.py 文件。但是,当我尝试将这些迁移应用到数据库并创建 table 时,它说没有要应用的迁移并且它不会创建 table。不知道为什么。

机器0001_initial.py

class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
    migrations.CreateModel(
        name='Appear',
        fields=[
            ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ('Show', models.CharField(max_length=100)),
            ('Media', models.CharField(blank=True, choices=[('TV', 'TV'), ('Radio', 'Radio'), ('Youtube', 'Youtube'), ('Podcast', 'Podcast')], max_length=30, null=True)),
            ('Episode', models.IntegerField()),
            ('Date', models.DateField(max_length=100)),
            ('Time', models.TimeField()),
            ('Producer', models.CharField(max_length=100)),
            ('Producer_Email', models.EmailField(max_length=254)),
        ],
    ),
]

为什么 table 没有被创建?

settings.py

INSTALLED_APPS = [
'machine.apps.MachineConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
}]

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': 'Houston',
    'USER': 'postgres',
    'PASSWORD': '1234',
    'HOST': 'localhost'     
}

我已经添加了我的 settings.py 希望这有帮助。

我的愚蠢错误。我在 settings.py 文件上使用数据库的主密码。我使用了默认的 postgres 密码,这就是它没有添加迁移的原因。我一更改密码,它就添加了它。

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': 'Houston',
    'USER': 'postgres',
    'PASSWORD': '1234',
    'HOST': 'localhost'     
}

我更改了它并使用了我用来登录数据库的主密码并且它起作用了。

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': 'Houston',
    'USER': 'postgres',
    'PASSWORD': 'A*******',
    'HOST': 'localhost'     
}