Login

Tag "compress"

Snippet List

CompressedTextField

I found my self doing data migration for a client, and also found that their old system (CSV) had 4 text fields that were 2 to 4MB each and after about 2 minutes of hammering the mysql server as I was parsing this and trying to insert the data the server would drop all connections. In my testing I found that if I didnt send those 4 fields the mysql server was happy to let me migrate all my data all (240GB of it). So I started thinking, "I should just store these fields compress anyways, a little over head to render the data, but thats fine by me." So thus was born a CompressedTextField. It bz2 compresses the contents then does a base64 encode to play nice with the server storage of text fields. Once I started using this my data migration, though a bit slower then without the field data, ran along all happy.

  • text
  • model
  • field
  • compress
Read More

Google Closure support in django-compress

A filter to integrate Google Closure compiler in django-compress plugin. 1. [download django-compress](http://code.google.com/p/django-compress/) 2. install it 3. [download Closure Compiler](http://code.google.com/closure/compiler) 4. put the jar at the root of your project 5. put this snippet as a **__init__.py** file in a **google_closure** directory in the filters directory of the plugin 6. add `COMPRESS_JS_FILTERS = ('compress.filters.google_closure.GoogleClosureCompilerFilter',)` to your settings.py You can test `COMPRESS_CLOSURE_JS_ARGUMENTS = {'compilation_level': 'ADVANCED_OPTIMIZATIONS', }` in your settings.py too

  • google
  • js
  • minify
  • closure
  • compress
Read More

GzipFileSystemStorage

`GzipFileSystemStorage` is a `FileSystemStorage` subclass that transparently compresses files. [More Info](http://theidioteque.net/blog/2009/9/29/gzipfilesystemstorage/)

  • compression
  • file
  • gzip
  • storage
  • compress
Read More

3 snippets posted so far.