Django South Notes


South is “a tool to provide consistent, easy-to-use and database-agnostic migrations for Django applications.” However, as South’s website says, since Django 1.7 now has its own migrations tool South has been deprecated. I personally think the new Django migrations are a little bit better.

However we still use South at FiveStars and I thought other people who still use South might appreciate these notes.

See list of migrations (asterisks means already applied)

$ ./ migrate –list [app name]

Apply latest migrations

$ ./ migrate [app name]

Fake migration

$ ./ migrate [app name] [version #] –fake

Migrate backwards

$ ./ migrate [app name] [version #]

Migrate back to zero state, i.e. nothing

$ ./ migrate [app name] zero

Create first migration

$ ./ schemamigration [app name] –initial

Create subsequent migrations

$ ./ schemamigration [app name] —-auto

Create empty schema migration

$ ./ schemamigration [app name] —-empty [migration name]

Create data migration

$ ./ datamigration [app name] [migration name]

Review migration history

select * from south_migrationhistory order by applied;

Redo migrations that have been hand edited

Sometimes you will find someone followed the bad practice of hand editing a migration after it has been committed. For example they’ll add another column. Because you have already run the migration you may not notice this until many migrations later when something breaks because of this missing column.

To fix this:

  1. Fake migration backwards to the edited migration
  2. Migrate back one before the edited migration
  3. Migrate forward one for the edited migration
  4. Fake migrate forwards the rest until you get to your current state
  5. Migrate the migration that previously was giving problems

Google App Engine

Recently I learned about Google’s App Engine and I must admit I am extremely impressed.  I am already have heard of at least two start ups that are deploying on it.

What it promises in terms of scalability and the amount it gives for free in terms of storage and bandwidth is impressive.  It is too bad it has not announced yet the terms when you begin to go over these limits.

I watched this tutorial on developing and deploying an application on Google App Engine.

My initial impressions were:

  • Python, hmmm…
  • Django, interesting…
  • this is not nearly as easy as Ruby on Rails

Still once has to believe this is going to help Python and its web framework, Django, in terms of momentum.