Thread local fix for mediagenerator
As suggested by the author at https://groups.google.com/forum/#!topic/django-non-relational/hmZTNwBtNYE