Django South:为多个应用程序创建架构迁移 [英] Django South: Creating schemamigration for more than one app

查看:31
本文介绍了Django South:为多个应用程序创建架构迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'M using django south on a bigger project, the only thing I don't like about it, that you can't create schemamigrations for all of your apps at once (I have a lot of apps that inherit from the same abstract model, if I change that base model there are alot of apps to migrate) - thought you can actually migrate all of them at once (using migrate --all).

So I'd like to know if theres an easy solution for django south to handle a bunch of apps at once or if anyone has a nice script ready for doing that?

解决方案

First thing: separate applications should limit model interactions

now that it's said, let's embrace the constraint. No south cannot create a single migration file for many apps and I don't know how to generate many migrations for many app in a single manage.py command.

All that is left to you is a script now. You could use the amazing fabric http://docs.fabfile.org/ to have a single command to generate your migrations :

APPS_TO_WATCH = ['myapp','myotherapp','toomanyapps']
def migration():
    for app in APPS_TO_WATCH:
        local('python manage.py schemamigration %s --auto' % app)

and then call it using fab migration

这篇关于Django South:为多个应用程序创建架构迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆