python manage.py makemigrations blog返回在应用'博客'中未检测到任何更改

时间:2017-07-15 08:49:15

标签: python django django-models django-migrations

这是model.py

中的崇高文本编辑器代码
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.
class Post(models.Model):
    STATUS_CHOICES = (
        ('draft', 'Draft'),
        ('published', 'Published'),
    )
    title = models.CharField(max_lenght=250)
    slug = models.SlugField(max_lenght=250)
    content = models.TextField()
    seo_title = models.CharField(max_lenght=250)
    seo_description = models.CharField(max_lenght=160)
    author = models.ForeignKey(User, related_name='blog_posts')
    published = models.DateTimeField(default=timezone.now)
    Created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    status = models.CharField(max_lenght=9, choices=STATUS_CHOICES, default='draft')

    def __str__(self):
        return self.title

===>>保存在sublime文本编辑器后,我打开命令promt和键入命令“python manage.py makemigrations blog” 它返回了一个错误 - 在应用'博客'中未检测到任何变化

enter image description here错误的屏幕截图

1 个答案:

答案 0 :(得分:1)

我通过从数据库中删除迁移条目来解决这个问题,因此,转到您正在使用的数据库,django_migrations表中将有一个关于您的表的条目删除该条目并再次运行该命令。

相关问题