views:

52

answers:

2

Hi all, I need your advice on managing a Django application as it grows in terms of features and models.

For instance as a application grows, we often need to add in new features.

Adding new features involves adding new models, or adding a new field within a model.

How would you go about doing that without closing the web application ( which runs on DJango)

How would you integrate versioning tools such as GIT in managing your DJango project/app? Best.

+3  A: 

A comprehensive answer would be too long and very subjective. I will instead try to point you in the direction of some very handy tools that will help you answer some of the points raised in your question.

  1. South for adding new models and dealing with changes to existing models. South is a very handy migration tool.
  2. Fabric and/or Buildout for deploying your application, changes and all.
  3. Pinax for letting you get away without reinventing the wheel as well as for new ideas on how to tackle your problems. Pinax is a collection of (mostly) pluggable Django applications that solve common problems.

Various Django developers have written on the subject of integrating git etc. A Google search should help you find the popular ones. For e.g. here is one about deploying Django applications written by Jacob Kaplan-Moss, one of the founders of Django.

Here are some things that I learned from my experience. They are not all Django specific.

  1. Clearly define sanity checks when you are about to migrate data/schema. Verify them post migration.
  2. Keep a project diary. Log all "events" such as migrations, version changes etc.
  3. Keep an eye on Django Snippets. Quite handy.
Manoj Govindan
A: 

the idea of the framework is really to structure your application, so the application should grow in a sane way if you follow the Model/View/Template structure.

What is great about django is that each functionnality should be contained by an application. If you need a new functionnality, you create a new application and thus a new model. Things stay separated and clear.

Concerning git you should check this.

Mermoz
hmm i see. but what if i want to add a new field in an existing model? how do i do that?
DjangoRocks
@DjangoRocks: use a migration tool to add a field to an existing model. For example see: http://south.aeracode.org/docs/tutorial/part1.html#changing-the-model
Manoj Govindan
if you don't want to use another tool (my case): to add a field: add it with the null=True, blank=True and run sync db. to remove a field: remove it from the model, remove it from the db with an alter table and run syncdb.
Mermoz
@Mermoz: interesting solution. What do you do when you encounter fields that cannot be `null` or `blank`?
Manoj Govindan