Simple example for using Cheetah templates with Django
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Django/Cheetah Example

This is a simple project and application demonstrating using Cheetah (with dynamically compiled templates) for building views inside of Django applications.


Getting Started

For all intents and purposes, using Cheetah in place of Django's templating system is a trivial change in how you write your views.

After following the Django getting started documentation, you'll want to create a directory for your Cheetah templates, such as Cheetar/templates. Be sure to touch in your template directory to ensure that templates can be imported if they need to.

Add your new template directory to the TEMPLATE_DIRS attribute in your project's

Once that is all set up, utilizing Cheetah templates in Django is just a matter of a few lines in your view code:

import Cheetah.Django

def index(req):
    return Cheetah.Django.render('index.tmpl', greet=False)

Note: Any keyword-arguments you pass into the Cheetah.Django.render() function will be exposed in the template's "searchList", meaning you can then access them with $-placeholders. (i.e. $greet)