Things I’ve learnt in the last 2 weeks

I know django fu

Raindrops on roses and whiskers on kittens
Bright copper kettles and warm woolen mittens
Brown paper packages tied up with strings
These are a few of my favorite things

– Favourite Things, Maria

Here are some cool stuff I’ve learnt in the last couple of weeks:

  1. South: For those new to Django, one of your grievances might be the difficulty in changing the database schema. This is especially true if you’re not sure what the end product looks like. For example, if you were to change your models class definitions either by adding a column or changing the field type, syncdb will not pick this up. The workaround is to drop your table (and all the data) and run syncdb again. That sucks, enter South. What South does is that it first creates a schema of your changes and then applies it. Once you’ve set it up, it’s as simple as creating a schema like this: ./manage.py schemamigration <app_name> –auto and then applying it like this ./manage.py migrate <app_name>. Here is the tutorial link.
  2. Unit tests: Unit tests form the backbone of TDD. The idea is that you write a test to achieve a desired outcome before coding it. Django’s testing module is very similar to Python. You can read more about it here. Here are some useful links I found about Unit testing in Django.
    1. http://dougalmatthews.com/articles/2010/jan/20/testing-your-first-django-app/
    2. http://greaterdebater.com/blog/gabe/post/12
    3. http://toastdriven.com/blog/2011/apr/10/guide-to-testing-in-django/
  3. Git: I’ve been using Git for about 3 weeks now. I think I’ve got the basics nailed down and managed to merge a few conflicts as well. Here are some useful links and tools for you Git users
    1. http://kdiff3.sourceforge.net/ – to EASILY solve conflicts. sudo apt-get install kdiff3.  Launches with git mergetool
    2. http://sourceforge.net/projects/qgit/ – a visualisation of git log. It also allows you to easily retrieve old documents in the git repository. sudo apt-get install qgit. Launches with qgit
    3. http://help.github.com/git-cheat-sheets/ – a cheatsheet with all the important commands
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s