Skip to main content

Delicious delayed and cached database-logging for django.

Project description

Version : 0.2.0 Author : Thomas Weholt <> License : GPL v3.0 WWW : Status : Experimental/Alpha/Proof-of-concept.


Deliciously delayed and cached database logging for django.

FYI: The code is still in early alpha stage of development so beware.

NB! It sorta looks like the std module logger in python, but it’s not. This is that one time that even if it looks like a duck and quacks like a duck, it’s still not a duck.

The code has so far only been tested using SQLite, Django 1.3, Python 2.6.6 on Ubuntu 10.10.


Avocado is meant to be used when you want to log huge amounts of log entries related to the same context, store the log in the db for easy sorting and viewing, and not have the performance hit of using the django orm.

You might do something like this in your view:

from avocado.context import get_context

with get_context("filescanning") as log:
    for filename in somefilescanningmethod():
        # do something with the file and store some information about it"Did something to %s." % filename)

You can also log information and add an instance of a django model. In the admin you can see the log and click to go directly to the related model:

with get_context("UserProcessing") as log:
    for usr in User.objects.all():
        # do something with the user and store some information about it"Did something to %s." % user, instance=user)

You can also log exceptions and avocado will try to log more than just the name of the exception being raised, but this not formatted very pretty at the moment and the code seems to bring along a lot of useless info. Still, here’s how to test it:

with get_context("UserProcessing") as log:
        a = 0
        b = 2
        c = b / a
    except Exception, e:
        log.exception("Math exception: %s" % e)

You don’t have to pass the exception along. Avocado will dig out lots of stuff for you.


pip install django-avocado


hg clone python install

Add avocado to INSTALLED_APPS. You might have to copy or symlink to the templates in the avocado-folder, but I don’t think so.


  • django
  • dse


0.2.0 : Rewrote some to be compatible with the latest release of DSE. 0.1.0 : Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Django-Avocado, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size Django-Avocado-0.2.0.tar.gz (18.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page