V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yeelone
V2EX  ›  Python

django south 如何加入新的model ?

  •  
  •   yeelone · 2013-09-03 23:47:33 +08:00 · 2830 次点击
    这是一个创建于 3859 天前的主题,其中的信息可能已经有所发展或是发生改变。
    首先项目是git clone 下来的,已经是转换为south 了(manage.py convert_to_south),现在我需要在django 中新加入一个model ,例如 :

    class NewModel(model.Models):

    name=mdels.CharField(max_length=300)


    现在我是不是执行以下的命令就可以:

    manage.py schemamigration my_db_app --auto
    manage.py migrate my_db_app

    ????

    我之前在单机上测试的时候是一直这样做的,但是当我换了台电脑,就会出现各种错误,所以我不确定是不是这样操作,请有django south 经验的朋友给指导一下用法 。谢谢​


    2 条回复    1970-01-01 08:00:00 +08:00
    imom0
        1
    imom0  
       2013-09-04 00:32:29 +08:00
    试试 `manage.py schemamigration my_db_app --add-model NewModel` ?

    http://south.readthedocs.org/en/latest/commands.html#id1
    mozillazg
        2
    mozillazg  
       2013-09-04 09:40:38 +08:00
    新增 model 是 `--init`,`--auto` 是用来创建改动情况的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1045 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:33 · PVG 06:33 · LAX 15:33 · JFK 18:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.