美文网首页
django south has no migrations

django south has no migrations

作者: leyu | 来源:发表于2016-12-21 11:16 被阅读0次

    django 项目新增了一个app,需要建立新表,用的south来管理。
    执行完pyhton manage.py schemamigration troublereport --initial,正常,
    然后执行pyhton manage.py migrate troublereport,报错了,报的是另一个app的错误has no migrations
    原因是south根据表south_migrationhistory,发现有未执行的migrate,但是在app目录下却未找到migrations目录,导致报错。可能是以前的app用过south管理,未正常结束south流程导致。
    解决办法:从south_migrationhistory表里删除报错的app的记录就行了。
    参考:https://yuji.wordpress.com/2014/02/27/south-migration-app-has-no-migrations/
    if you get this error for an app that truly doesn’t have any migrations, and perhaps isn’t even related to your project, it most likely means the south_migrationhistory table has row that matches one of your INSTALLED_APPS.
    This can happen if at one point the app had migrations, but the latest version doesn’t (happens to third party apps), or you once built an app with migrations in the early days of your project.
    Remove it via SQL to fix the problem.
    DELETE FROM south_migrationhistory WHERE app_name = ‘offending_appname’;

    相关文章

      网友评论

          本文标题:django south has no migrations

          本文链接:https://www.haomeiwen.com/subject/knhqvttx.html