wiki:GzipCompressing
Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 1 (modified by ramy, 13 years ago) (diff)

--

Gzip Compressing Content

You can setup Turbogears to compress all the data it sends to the web browser using a cherrypy filter called GzipFilter?. If you are serving a lot of text based content, you will probably want this enabled to save bandwidth and to provide a much faster loading experience to the users. You can enable this by editing config/app.cfg file:

[/]
gzip_filter.on = True
gzip_filter.mime_types = ["application/x-javascript", "text/javascript", "text/html", "text/css", "text/plain"]

Note that if mime_types isn't specified, the gzip filter only applies to default ["text/html", "text/plain"].

In the above example we only gzip javascript, css and html content. Images and other binary files are left out as they are usually pre-compressed (jpg, gif, etc.)