django syncdb和更新的模型 [英] django syncdb and an updated model

查看:90
本文介绍了django syncdb和更新的模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我更新了我的模型,但是在添加了一个BooleanField之后,当我执行 python manage.py syncdb 时,它不会将新的字段添加到数据库中该模型。如何解决这个问题?

解决方案

从Django 1.7开始



Django已经建立了对迁移的支持 - 请查看文档



对于Django 1.6及更早版本



Django不支持开箱即用的迁移。有一个可插拔的Django应用程序,尽管如此,它的功能非常好。它被称为南部


I have recently updated my model, added a BooleanField to it however when I do python manage.py syncdb, it doesn't add the new field to the database for the model. How can I fix this ?

解决方案

From Django 1.7 onwards

Django has built in support for migrations - take a look at the documentation.

For Django 1.6 and earlier

Django doesn't support migrations out of the box. There is a pluggable app for Django that does exactly that though, and it works great. It's called South.

这篇关于django syncdb和更新的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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