Skip to main content

Jinja2 template integration for Morepath

Project description

CI Status

more.jinja2: Jinja2 template integration for Morepath

more.jinja2 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,

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


0.3 (2022-05-29)

  • Apply pyupgrade --py36-plus

  • Use black code formatter.

  • Add support for Python 3.7, 3.8, 3.9 and 3.10.

  • Fix test collection.

  • Drop support for Python 2.7, 3.4, 3.5.

  • Updated the test suite to work with Morepath 0.15.

  • Set up integration with Travis CI. (superseded)

  • Added Tox environments for Python 3.5 and 3.6, PyPy 3, PEP8. (partially superseded)

  • Using Python 3.5 for PEP8 and coverage. (superseded)

  • Clean up meta data.

  • Use GitHub Actions for CI.

  • Fix Jinja2 integration - the autoescape extension was removed as now it is built-in.

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.

Source Distribution

more.jinja2-0.3.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

more.jinja2-0.3-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page