KH – Musings on Tech and Life.

Harness the power of Django 3rd party apps

leave a comment »

Django is known for the ease of plugging in third-party open-sourced applications into your projects. There is a wealth of Django third-party apps to choose from and several have seen widespread use (and rightfully so!). They fall into three general categories:

  • Development tools – these apps allow you to code your application more efficiently
  • Internal functionality – these apps help power your product – async task management, screen scraping, thumbnailing, etc.
  • External features  – these apps provide pluggable user-facing features – tagging, registration, user notifications, etc.

Could you code your own implementation of what is provided by third-party applications? Of course! Is it efficient to do so? It depends, but if we are talking about development tools or non-core functionality where the general case satisfied by open source alternatives is sufficient, then most likely the answer is no. On the other hand, the more core the functionality is to your product or the more specialized your use case, the higher the likelihood that you will end up rolling your own implementation. Do what makes sense.

Here are a few applications I’d like to point out. You can browse a much more extensive list at Djangoplugables.com.

Third-party apps: Development tools
Regardless of what you are building with Django, these come highly recommended.

1. South
Setting up your database schema in Django is quick and easy. Create your data models in models.py, sync them with your database, and watch Python code get turned into a schema just like that. Maintaining your database schema, however, can be tedious. If you need to drop fields or change the attributes of a field, you not only need to change your data model, but you also have to go into your database and make the parallel changes manually. Having to do things twice? Bummer. Having to do things manually? Double bummer.

Enter South, which makes database maintenance efficient by adding a migration layer. If you change your data model, you can quickly sync the changes with your database in seconds. South compares your latest migration (i.e., snapshot of your schema) with your data model and knows exactly what DDL queries to run to sync the two. Easy breezy.

2. Django-debug-toolbar
Absolutely great for debugging and performance tuning in your development environment. Django-debug-toolbar creates a HTML/Javascript overlay on top of your web application and comes with modules that allow you to deep dive into your environment variables, HTTP headers, SQL queries, and more.

3. Sentry
Sentry is a neat log and error tracking application built by the guys at Disqus, the exciting startup that powers comment systems for the likes of CNN, Techcrunch, Fox News and IGN. It is also the largest deployment of Django in the world. Take a look at their blog post introducing Sentry.

Third-party apps: Internal functionality
Specific use-cases, but powerful.

1. Celery
Celery provides functionality to handle asynchronous tasks and job queuing. There are plenty of use cases:

2. Haystack
Haystack allows you to integrate search functionality into your application. And similar to how the Django ORM can can connect to any number of pluggable back-ends (mySQL, PostgreSQL, SQLite, etc.), Haystack can sit on top of several custom search solutions.

3. easy_thumbnails and sorl-thumbnail
Both are thumbnailing applications that showed up in a survey by Jacob Kaplan-Moss, a co-creator of Django.

Third-party apps: External features
Just listing a few here…

1. Tagging – django-tagging
2. User registration –
django-registration
3. Pagination tools –
django-pagination
4. User notifications –
django-notification

Written by KH

January 10, 2011 at 10:20 pm

Posted in Uncategorized

Leave a comment