好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Django项目数据库迁移报错:No changes detected

今天在执行Django项目数据库迁移的时候,执行命令出现报错:

 No changes detected 

然后按照操作添加项目名称,添加--empty app01后再执行命令出现新的报错:

 App 'app01' could not be found. Is it in INSTALLED_APPS? 

最终找到解决办法,在settings.py文件中找到对应模块并在末尾添加项目名即可:

 INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app01',
] 

之后再执行便不会报错:

 Migrations for 'app01':
  app01\migrations\0002_book.py
    - Create model Book 

查看更多关于Django项目数据库迁移报错:No changes detected的详细内容...

  阅读:37次