Skip to main content

Jinja2 template integration for Morepath

Project description

more.jina2: Jinja2 template integration for Morepath

more.jina2 is an extension for Morepath that adds Jinja2 template support when you use the .jinja2 extension.

For details on the Jinja2 template language see the Jinja2 template designer documentation.

Example usage:

from more.jinja2 import Jinja2App

class App(Jinja2App):

class Person(object):
     def __init__(self, name): = name

def get_template_directory():
    return 'templates'

@App.html(model=Person, template='person.jinja2')
def person_default(self, request):
    return {'name':}

and then in person.jinja2 (in the templates subdirectory):

<p>Hello {{name}}!</p>

Note that the Jinja2 documentation uses the .html extension for Jinja2 templates, whereas this extension uses .jinja2 instead.

To control Jinja2 behavior you can define a jinja2 setting section in your app. For instance:

def get_setting_section():
    return {
      'auto_reload': False,
      'autoescape': True,
      'extensions': ['jinja2.ext.autoescape']

For details on Jinja2 configuration options, consult the Jinja2 API documentation.


0.2 (2015-04-09)

  • Actual release to PyPI.

0.1 (2015-04-09)

  • Initial public release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for more.jinja2, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size more.jinja2-0.2.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page