如何从模型包层次结构迁移模型,而不是从Django中的SOUTH迁移到models.py? [英] How to migrate models from a models package hierarchy and not from models.py with SOUTH in Django?

查看:189
本文介绍了如何从模型包层次结构迁移模型,而不是从Django中的SOUTH迁移到models.py?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hy!



我将模型放在models包中的层次结构中:

 模型
| -a.py
| -b.py

而不是将所有的模型都放在models.py



但是当我为South运行迁移命令时,它没有找到任何一个: / p>

  schemamigration my_app --auto 

在元类中已经存在app_label ='my_app'



我使用自动,因为表已经更改。

$ b您是否已经导入了 __ init __。py 中的所有模型?如果你这样做,那么它的运作方式没有任何区别。


Hy!

I have my models in a hierarchy below "models" package:

 models
 |-a.py
 |-b.py

instead of having all my models into the models.py

But when I run the migration command for South it doesn't find any of them:

schemamigration my_app --auto

In the meta class already exists the app_label='my_app'

I use auto because the tables are already changed.

解决方案

Have you imported all the models in __init__.py? If you've done that, there's effectively no difference in how it works.

这篇关于如何从模型包层次结构迁移模型,而不是从Django中的SOUTH迁移到models.py?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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