报错修改后,makemigrations 总反馈 No changes detected in app

18-2作业,更新models.py, if 语句忘了写:,

      def __str__(self):
        if len(self.text) <50
            return self.text[:50]
        else :
            return self.text[:50]+'...'

>python manage.py makemigrations learning_logs 报错


    if len(self.text) <50 

                        ^
SyntaxError: invalid syntax

修改正确,再次运行,反馈“No changes detected in app 'learning_logs'”。

试了几次都不成,把\migrations 和\migrations\__pycache__ 里最后几条记录文件删除,再执行,OK了

(virtual_env) C:\Users\ThinkPad\tmp\virtual_env>python manage.py makemigrations learning_logs
Migrations for 'learning_logs':
  learning_logs\migrations\0003_auto_20200604_1635.py
    - Change Meta options on entry

(virtual_env) C:\Users\ThinkPad\tmp\virtual_env>python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, learning_logs, sessions
Running migrations:
  Applying learning_logs.0003_auto_20200604_1635... OK

你可能感兴趣的:(报错修改后,makemigrations 总反馈 No changes detected in app)