django_evolution:不错的django数据库版本插件

django官方自带的manage.py syncdb只能根据已有的models同步新建数据表,而无法做到和rails一样根据实体同步修改数据表,好在有第三方插件可以提供这项功能。
django_evolution
When you run ./manage.py syncdb, Django will look for any new models that have been defined, and add a database table to represent those new models. However, if you make a change to an existing model, ./manage.py syncdb will not make any changes to the database.
This is where Django Evolution fits in. Django Evolution is an extension to Django that allows you to track changes in your models over time, and to update the database to reflect those changes.
使用步骤
1. checkout http://django-evolution.googlecode.com/svn/trunk/ 获取源代码
2. cd django_evolution -> python setup.py install 安装
3. 修改你的django项目的settings.py的INSTALLED_APPS项,比如
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django_evolution'
)

4.进入你的django项目文件夹, python manage.py syncdb创建 django_evolution所需的表
5.python manage.py evolve --hint --execute 根据实体同步修改你的数据表
over

转载于:https://www.cnblogs.com/yyliuliang/archive/2009/04/30/1447268.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值