Here is a short list of weppy-Haml pros vs the default html templating system:

Less code to write

Your code will be more human readable

You don't have to write the pass instructions, just to correctly indent your code

So, you still gonna use html? :)

Installation

You can install weppy-Haml using pip:

pip install weppy-Haml

And add it to your weppy application:

fromweppy_hamlimportHamlapp.use_extension(Haml)

Configuration

weppy-Haml has 2 configuration options:

parameter

default value

description

set_as_default

False

set the default extension for templates to haml

auto_reload

False

check for changes in template files and reload them

If you only use haml templates, you should set the set_as_default parameter to True:

app.config.Haml.set_as_default=Trueapp.use_extension(Haml)

so when you expose a function from your application without explicitly pass the template

@app.expose()defmyfunction():# some awesome code

weppy will look at the haml file (in this case myfunction.haml) insted of the html one.

Warning
When you set configuration values for the extension, ensure to do that before adding the extension to your application.

Auto reloading haml templates

The auto reload feature of Haml extension works in the same way of weppy caching system for templates – introduced since v0.3 – so it's automatically enabled when your application is in debug mode, ignoring the configuration value.

Depending on your needs – and remembering that the auto-reload feature might affect your application performance in production – you can set the auto_reload parameter to True, but it will work only if you set the templates_auto_reload parameter of your application configuration to True as well: