All Projects → sheppard → django-mustache

sheppard / django-mustache

Licence: MIT license
Mustache (Pystache) template engine for Django 1.8 and newer, with support for Django context processors. Designed to support offline-capable web apps via progressive enhancement.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to django-mustache

Grmustache.swift
Flexible Mustache templates for Swift
Stars: ✭ 538 (+2590%)
Mutual labels:  template-engine, mustache
moustachu
Mustache templating for Nim
Stars: ✭ 58 (+190%)
Mutual labels:  template-engine, mustache
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (+1515%)
Mutual labels:  template-engine, mustache
Handlebars.net
A real .NET Handlebars engine
Stars: ✭ 723 (+3515%)
Mutual labels:  template-engine, mustache
Api2html
Using the data from your API, generate the HTML on the fly! Server-side rendering of the mustache templates
Stars: ✭ 97 (+385%)
Mutual labels:  template-engine, mustache
Spring Boot Email Tools
A set of services and tools for sending emails in a Spring Boot 1.5.x application using a Template Engine
Stars: ✭ 164 (+720%)
Mutual labels:  template-engine, mustache
Bbmustache
Binary pattern match Based Mustache template engine for Erlang/OTP.
Stars: ✭ 141 (+605%)
Mutual labels:  template-engine, mustache
morestachio
Lightweight, powerful, flavorful, template engine.
Stars: ✭ 45 (+125%)
Mutual labels:  template-engine, mustache
nhplate
Net Heroes Template Engine for Node.js and browsers
Stars: ✭ 26 (+30%)
Mutual labels:  template-engine
voldemort
A simple static site generator using Jinja2 and Markdown templates.
Stars: ✭ 48 (+140%)
Mutual labels:  template-engine
cheetah3
Cheetah3 is a free (MIT) and open source template engine for Python.
Stars: ✭ 106 (+430%)
Mutual labels:  template-engine
LiquidKit
Liquid template language parser engine in Swift.
Stars: ✭ 19 (-5%)
Mutual labels:  template-engine
chimera
🐍 A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
Stars: ✭ 12 (-40%)
Mutual labels:  mustache
papercraft
Composable templating for Ruby
Stars: ✭ 162 (+710%)
Mutual labels:  template-engine
raku-Template-Mustache
Raku library for the Mustache template format
Stars: ✭ 16 (-20%)
Mutual labels:  mustache
pug4py
Use Pug.js within any python framework
Stars: ✭ 17 (-15%)
Mutual labels:  template-engine
Magento2-Twig
Twig Template Engine for Magento2
Stars: ✭ 58 (+190%)
Mutual labels:  template-engine
karkas
A tiny template engine based on TypeScript
Stars: ✭ 14 (-30%)
Mutual labels:  template-engine
typed-html
TypeSafe HTML templates using TypeScript. No need to learn a template library.
Stars: ✭ 92 (+360%)
Mutual labels:  template-engine
pogonos
Another Clojure(Script) implementation of Mustache templating language
Stars: ✭ 56 (+180%)
Mutual labels:  mustache

django-mustache

A straightforward Mustache-powered template engine for Django, extracted from wq.db and updated to support the new template backend infrastructure in Django 1.8 and newer. django-mustache facilitates progressive enhancement by allowing you to share the same templates between Django and an offline-capable JavaScript web app. Combined with a shared URL structure, this approach ensures that each page in your site can be selectively rendered on the server or on the client as needed.

A number of Pystache/Mustache backends for Django exist, though many are outdated. Only this library provides all of the following:

  • Full integration with existing Django context processors like django.template.context_processors.csrf and django.contrib.auth.context_processors.auth.*
  • Full test suite
  • Installable via PyPI
  • Compatible with Django 1.8 and newer

*wq/app.js provides client-side equivalents for these context variables.

Latest PyPI Release Release Notes License GitHub Stars GitHub Forks GitHub Issues

Travis Build Status Python Support Django Support

Usage

pip3 install django-mustache

Configure django-mustache like you would any template backend:

# myproject/settings.py
TEMPLATES = [
    {
        'BACKEND': 'django_mustache.Mustache',
        'DIRS': [ '...' ],
        'APP_DIRS': False,
        'OPTIONS': {
            'context_processors': [ '...' ],
            'partials_dir': 'partials',
            'file_extension': 'html',
        }
    },
    # ...
]

The following configuration options are supported:

  • context_processors: equivalent to the Django template backend setting. The goal is to be able to use the same context processors for both Django and Mustache template backends. (Let us know if you come across any compatibility issues.)
  • partials_dir: If set, django-mustache will check each template directory for a subfolder containing Mustache partial templates. The default partial folder name is 'partials'. Set to False to disable this feature.
  • file_extension: File extension to use when searching for templates and partials. The default is '.html', which should not conflict with existing Django templates as long as completely separate directories are configured for Mustache templates. Django views typically include the extension in the template name - this is taken into account when searching for templates.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].