Wednesday, November 17, 2010

shpaml - haml for python and django

I've searched around for a nicer way to write HTML in Django, somewhat like HAML for Ruby.

There is an enormous amount of half-baked packages out there, but I find shpaml to fit my needs wonderfully.

It can be downloaded from

To automatically reload the shpaml templates, run

All together
#download shpaml
wget http://shpaml.webfactional.com/shpaml_py -O shpaml.py
#download django-shpaml-template-loader
hg clone http://bitbucket.org/jiaaro/django-shpaml-template-loader
python ./django-shpaml-template-loader/setup.py install
rm -rf ./django-shpaml-template-loader

I put the following in my settings file:
#I put the following
TEMPLATE_LOADERS = (
'shpaml_loader.filesystem',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

if DEBUG:
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', TEMPLATE_LOADERS),
)

... and it works like a charm :)

No comments:

Post a Comment