Here’s a practical idea which I have in use in a project of mine.
Most of you probably use some javascript library or have some javascript files that you use in your pylons application.
There’s also some talk going on related to javascript files compression, and more recently, minification.
While I’m developing, I like to use the normal(non compressed) javascript files, because it helps on debuging. But for production, using compressed javascript files reduces page load times.
Pylons Webhelpers comes with a useful function to help you include javascript files on your templates, javascript_include_tag.
The idea I had was at first, make that function provide the minified version of the JS file if we’re not running our application in debug mode. If we are on debug mode, server the normal file.
So, I added a minified option to that function above, which does just that.
After a while, I wanted to know how I could minify my own javascript files, and I found out about JSMin. There’s also a python version of it.
That’s when I also thought, hell, I could minify my own javascript files upon request, and even cache that so the routine only runs once.
Read on...
So, you’re like me and like to have trac constantly logging to file and you hate those files getting huge?
It is assumed that you keep all your trac environments on the same basedir, for example /var/lib/trac/.
Here’s a simple logrotate config file(normaly under /etc/logrotate.d/):
/var/lib/trac/*/log/trac.log {
weekly
rotate 7
missingok
create 640 www-data www-data
compress
}
I hope you enjoy this simple solution.
Welcome to my first blog online.
I’ve created this blog because of my python(and not only) code developments. Some of the projects I code are too small to have a full development site, so, I’ve decided to create a blog to post those small projects and get some feedback about them.
Of course, if the projects do get bigger, they’ll probably get their own site :)
Well, that’s it for my first post on my first blog…