Every repository with this icon (
Every repository with this icon (
Home
Welcome to the django-yslow wiki!
django-yslow utility adds new management commands & a couple of template tags which let you generate optimized builds of your Django application. Best practices recommended by Yahoo’s YSlow project are adopted. If you’re using Amazon S3 for hosting static files, you can use the upload_to_s3 management command to upload to S3 easily.
This project should be of interest to you if you’re writing a Django app and would like to achieve better YSlow grades!
What django-yslow offers
The Yahoo Performance page has a list of rules/best practices they adopt at Yahoo! and some of which are easily trackable and measurable via their YSlow extension to Firebug.
django-yslow will specifically help you with only the following aspects:
- Minify JS and CSS
- Needs YUICompressor.
- Minimize HTTP requests
- Combine multiple CSS/JS files into one file.
- Adding far-future Expires header
- Automatically “version” all static content.
- Use a CDN
- Support for Amazon S3
- Gzip components
- Support for Amazon S3
Support for more YSlow recommendations will be added soon.
How to use django-yslow
Checkout the latest version from git and put it somewhere in your PYTHONPATH.
Add “yslow” to INSTALLED_APPS in settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'yslow',
'yourproject.yourapp',
)
Once you’ve added “yslow” to your INSTALLED_APPS list, you can start using the management commands – “build” & “upload_to_s3”.
$./manage.py help
$./manage.py help build
$./manage.py help upload_to_s3
Minifying JS and CSS files
Before you can minify, yslow needs to know where you’ve installed YUI Compressor. Create an environment variable YUICOMPRESSOR_JAR or just add it to your settings.py file.
YUICOMPRESSOR_JAR = '/path/to/yuicompressor-2.2.5/build/yuicompressor-2.2.5.jar'
Now just do:
$./manage.py build --verbose --disable-versioning
This will build an optimized build and place it in a folder
Developer
Harish Mallipeddi (harish.mallipeddi@gmail.com)
http://poundbang.in/blog/







