Django、db update、south 和 sqliteman:确认。不是一个真正的问题。是不是更好了?
实际上,我已经看到,在 stackoverflow.com 询问后,可能会有很多类似的问题..但我已经找到了要写的框和我的谷歌搜索 也好不到哪儿去。 (我测试了 blekko.com 一段时间......作为一个搜索引擎......尝试一下)
回到问题:
如果我有: models.py
class someclass(models.Model):
title = models.CharField(max_length=200)
并且我运行所有内容直到网站正常工作......
现在我做(models.py):
class someclass(models.Model):
title = models.CharField(max_length=200)
sub_title = models.CharField(max_length=200)
我使用 sqliteman 或 phpmyadmin 添加一个名为“sub_title”的列,这将得到一些 默认值,即NULL。 (不管一些 django 约束,比如 not NULL)
我会在 django 中破坏某些东西吗?
我想我总是有可能转储数据库并将其读回。 还不确定如何在 django 中以干净的方式做到这一点,但应该有办法。 有这样的办法吗?
我的问题到此为止。
但作为额外的提示,我确实检查了南方,这对我来说“开箱即用”不起作用, 特别是对于现有项目。在解决其他问题之前, 我意识到在开发网站时我只需要更新栏目。
我向我的客户展示(目前这是免费/免费无钱的情况) 开发阶段......我不想在每个版本都重置数据库。
I have seen that actually, after asking in stackoverflow.com, there might be a lot of equivalent questions.. But I got the box where to write already and my google searches
are not any better. (I was testing blekko.com for a while.. as a search engine.. give it a try)
Back to the question:
If I have: models.py
class someclass(models.Model):
title = models.CharField(max_length=200)
And I run all the stuff till the site is working...
Now I do (models.py):
class someclass(models.Model):
title = models.CharField(max_length=200)
sub_title = models.CharField(max_length=200)
And I use sqliteman or phpmyadmin to add a column named 'sub_title' which will get some
default value, namely NULL. (regardless of some django constrains, like not NULL)
Would I brake something within django?
I guess I would always have the possibility to dump the db and read it back.
Not sure yet how to do it in django in a clean way but there should be a way.
Is there such a way?
My question stops here.
But as additional hint, I did check south which didn't work for me 'right out of the box',
in particular for an existing project. Before to get into some other problems,
I realized that I only need columns updates while developing the site.
I present to my customer (this is at present a free/free no money situation)
the stages of development... and I do not want to reset the DB at every version.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论