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
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 已经同步到gitbook,想阅读的请转到gitbook: Django 1.10 中文文档 This tutori...
- Django1.11版本的官方教程翻译。 在这篇教程中,我们将设置你的数据库,创建你的第一个模型,并快速介绍Dja...
- PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...