Skip to main content

UNKNOWN

Project description

Muffin-Jinja2 – Jinja2 template engine for Muffin framework.

Build Status http://img.shields.io/pypi/v/muffin-jinja2.svg?style=flat-square http://img.shields.io/pypi/dm/muffin-jinja2.svg?style=flat-square Donate

Requirements

  • python >= 3.3

Installation

Muffin-Jinja2 should be installed using pip:

pip install muffin-jinja2

Usage

Add muffin_jinja2 to PLUGINS in your Muffin Application configuration.

Options

JINJA2_AUTO_RELOAD – Auto reload changed templates (False)

JINJA2_CACHE_SIZE – Cache templates (50)

JINJA2_EXTENSIONS – Enable Jinja2 Extensions (None)

JINJA2_LOADER – Template loader (FileSystemLoader)

JINJA2_ENCODING – Default encoding for file loader

JINJA2_TEMPLATE_FOLDERS – List of template folders ([‘templates’])

Views

# Register custom context processor
# could be a function/coroutine
@app.ps.jinja2.context_processor
def custom_context():
    return { 'VAR': 'VALUE' }

# Register a function into templates
@app.ps.jinja2.register
def sum(a, b):
    return a + b

@app.register('/')
def index(request):
    """ Check for user is admin. """
    local_context = {'key': 'value'}
    return app.ps.jinja2.render('index.html', **local_context)

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-jinja2/issues

Contributing

Development of Muffin-Jinja2 happens at: https://github.com/klen/muffin-jinja2

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.

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

muffin-jinja2-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

muffin_jinja2-0.0.1-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file muffin-jinja2-0.0.1.tar.gz.

File metadata

File hashes

Hashes for muffin-jinja2-0.0.1.tar.gz
Algorithm Hash digest
SHA256 64d9d4970866f91aa63a71daa4d2124c06aa55de2c5c1386da6e684a98bb5a05
MD5 e5a27562a445222374613f5f4cb7a55c
BLAKE2b-256 1778edb7bbd93c4b2f366ab8489b86b4c2b714865953eef7f02f90ba170b12fd

See more details on using hashes here.

File details

Details for the file muffin_jinja2-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for muffin_jinja2-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 29f80e31f74f7e4f4cefa7025e44b6ca41e0c858326ce40d63e6479c4e96c86d
MD5 b7731d98af23ba07698d7542778c2fdb
BLAKE2b-256 c3aa612ef21a7fcddc62eb6e5bb1c1142867fad084ad6982446f3dca115dedb1

See more details on using hashes here.

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