Filter: #Open Source view all

Announcing django-cache-decorator

I have been using Django for over two years, and I have grown to love the rich feature set it comes with. Yes, there's a lot one ends up not using, but it is great that these things are there for when one needs it. It's worth noting that these extra features do not cause a performance impact. Django can be stripped down and is capable of returning < 10ms responses.

Django offers many interfaces with swappable backends. For example you can use the same ORM functions for interacting with Postgres or Mysql. Or you can send Email directly from the server or via a commercial service like SendGrid (3rd party). Or you can choose from a variety of cache backends: In-memory, Memcache, or Redis (3rd party).

And once one has experience with the Django framework, it is really quick to develop web applications. These are all reasons why it's compelling to invest further into Django.

I have put together a simple python package to make it easy to add caching to any function in a django project. It's called django-cache-decorator.

Installation

pip install django-cache-decorator

Example Usages

from django_cache_decorator import django_cache_decorator

@django_cache_decorator(time=0)
def geocodeGoogleAddressJson(location):
   """Cache indefinitely until cache is reset or expired"""
   ...


@django_cache_decorator(time=500, cache_key="TagManager:popularTags")
def popularTags(self):
   """Cache for 500 seconds. Specify a custom cache key"""
    ...


@django_cache_decorator(time=0, cache_type='redis')
def reverse_geocode(lng, lat):
   """Cache indefinitely with redis backend"""
   ...

How it works

When the @django_cache_decorator is applied to a function, it'll cache the results of that function. If no cache_key is passed, a cache key will be generated automatically from the function name and the arguments. See the function cache_get_key for details.

The decorator also supports the argument cache_type to specify which backend to use.

Announcing a Puppet module for Dokku

I am excited to announce that I published a Puppet module for installing Dokku. Dokku is a great tool for easily hosting and deploying projects. It's basically a copy of Heroku that can be installed on Ubuntu 14.04. I recommend Digital Ocean for $5 a month.

With Puppet and this module, you can declaratively install Dokku.

Links:
- https://forge.puppetlabs.com/rchrd2/dokku
- https://github.com/rchrd2/puppet-dokku

Installation

puppet module install rchrd2-dokku

Usage

node web {
  # install dokku
  class {'dokku':
    version => 'v0.3.12',
  }

  # install dokku plugins
  dokku::plugin { "dokku-rebuild":
    source => "https://github.com/scottatron/dokku-rebuild.git",
    version => "master",
  }
  dokku::plugin { "dokku-pg-plugin":
    source => "https://github.com/rchrd2/dokku-pg-plugin.git",
    version => "master",
  }
}

https://github.com/rchrd2/puppet-dokku

Non Projections

Using a custom VJ software I developed, I performed visuals at a couple of the early Nonprojects record label shows. The software I developed let me mix in a live video feed from a wireless camera which was mounted on the ceiling and pointed down at the performers.

However, after performing visuals twice, I concluded I didn't like it, and prefer performing music.

I released the software as open source on github. You can download it here: https://github.com/rchrd2/nonprojector

Tutorial Videos:
- https://www.youtube.com/watch?v=0FRYPPk-Ogk
- https://www.youtube.com/watch?v=Glr_HuwdWWU

Materials: Wireless camera, midi controller, projector, custom VJ software
June 2010