开发者

my Django development (needs advice)

I am writing a website using Django. I need to push the web site out as soon as possible. I don't need a lot of amazing things right now.

I am concern about the future development. If I enable registration, which means I allow more contents to be writable. If I don't, then only the admins can publish the content. The website isn't exactly a CMS.

This is a big problem, as I will continue to add new features and rewriting codes (either by adapting third-party apps, or rewrites the app itself). So how would either path affects my database contents?

So the bottom line is, how do I ensure as the development continues, I can ensure the safety of my data?

I hope someone can offer a little insights on this matter.

Thank you very 开发者_JS百科much. It's hard to describe my concern, really.


Whatever functionalities you will add after, if you add new fields, etc ... you can still migrate your data to the "new" database.

It becomes more complicated with relationships, because you might have integrity problems. Say you have a Comment model, and say you don't enable registration, so all users can comment on certain posts. If after, you decide to enable registration, and you decide that ALL the comments have to be associated with a user, then you will have problems migrating your data, because you'll have lots of comments for which you'll have to make up a user, or that you'll just have to drop. Of course, in that case there would be work-arounds, but it is just to illustrate some of the problems you might encounter later.

Personally, I try to have a good data-model, with only the minimum necessary fields (more fields will come after, with new functionalities). I especially try to avoid having to add new foreign keys in already existing models. For example, it is fine to add a new model later, with a foreign key to existing model, but the opposite is more complicated.

Finally, I am not sure about why you hesitate to enable registration. It is actually very very simple to do (you can for example use django-registration, and you would just have to write some urlconf, and some templates, and that's all ...)

Hope this helps !


if you are afraid of data migration, just use south...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜