推荐学习书目
› 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
inyfee
V2EX  ›  Python

django south 如何加入新的model ?

  •  
  •   inyfee · Sep 3, 2013 · 3982 views
    This topic created in 4778 days ago, the information mentioned may be changed or developed.
    首先项目是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 replies  •  1970-01-01 08:00:00 +08:00
    imom0
        1
    imom0  
       Sep 4, 2013
    试试 `manage.py schemamigration my_db_app --add-model NewModel` ?

    http://south.readthedocs.org/en/latest/commands.html#id1
    mozillazg
        2
    mozillazg  
       Sep 4, 2013
    新增 model 是 `--init`,`--auto` 是用来创建改动情况的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   759 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:58 · PVG 04:58 · LAX 13:58 · JFK 16:58
    ♥ Do have faith in what you're doing.