turbines in antarctica

These are some wind turbines powering an Antarctic Research Station.  And that’s also about as South as you can get in your quest for renewable energy.  But today we’re writing about migrating your databases South!  Or the following scenario:

You create an übercool insightful Django model.  You put some data on it, make some templates, … looks good!  And then you realize it wasn’t as cool as you thought.  You forgot to add … say the minimum operating temperature for your wind turbines.  Bummer!  Enter South ( intelligent schema and data migration).

 manage.py schemamigration app_name --initial

if you have not done syncdb yet:

 manage.py migrate app_name

if you have already done syncdb:

 manage.py migrate app_name --fake

Then edit your models.py and add all the fields you forgot to add,

Then create the new migration file and finally migrate the database:

 manage.py schemamigration app_name --auto 
 manage.py migrate app_name 

see also [djangopro] for a good explanation.

Also to check the migrations you have done so far simply run:

 manage.py migrate --list

 

INSTALLATION:

Go to /etc/apt/sources.list, for example:

$ sudo emacs -nw /etc/apt/sources.list

and add this at the bottom:

## added for Scrapy ##
deb http://archive.scrapy.org/ubuntu natty main

where you substitute natty with whatever your release is, and therefore with whatever the output of:

$ lsb_release -cs

Update and install,

$ sudo apt-get update
$ sudo apt-get install scrapy-0.15

and off you go!

I’ve found quite a few useful cheat sheets for the web which I’ll share with you all.

More below the fold, …

html5 cheat sheet

<HTML5>

  • small cheatsheet from Woorkup [PDF] [giant-jpeg]
  • comprehensive 4-page from Smashing Magazine [PDF]

I know, I know … no html5 goodness in django.  But you can start using it anyway.

css3 cheat sheet

<CSS3>

  • css goodness for Webkit from Sencha [PDF]
  • comprehensive 5 page from webgranth  [PDF]
  • css1, css2, css3 … which one has which attributes [page]

django cheat sheet screenshot

<Django>

  • For Django 1.0 from Mercurytide [PDF]
  • For Django 1.3 from RevSys [PDF]

and reference sheets,

git cheat sheet

<GIT>

and to keep things tidy and version-controlled …

  • Git cheat-sheet and best-practive from FourNova [PDF]
  • from Alex Zeitler simple and intuitive [PDF]
  • A simple one page from Nate Murray [PDF]

Now go, print them all in A3 or bigger, use them as wall-paper in your room and keep coding away.  For more cheat sheets see http://devcheatsheet.com/