Skip to main content

Use MJML in Django templates

Project description

https://travis-ci.org/liminspace/django-mjml.svg?branch=develop

Django + MJML

django-mjml

The simplest way to use MJML in Django templates.


Installation

Requirements:

  • Django v1.9+

  • mjml v2.0+

1. Install mjml.

See https://github.com/mjmlio/mjml#installation and https://mjml.io/documentation/#installation

2. Install django-mjml.

  • Via pip:

    $ pip install django-mjml
  • Via setuptools:

    $ easy_install django-mjml

For install development version use git+https://github.com/liminspace/django-mjml.git@develop instead django-mjml.

3. Set up settings.py in your django project.

INSTALLED_APPS = (
  ...,
  'mjml',
)

Usage

Load mjml in your django template and use mjml tag that will compile mjml to html:

{% load mjml %}

{% mjml %}
    <mjml>
    <mj-body>
    <mj-container>
        <mj-section>
            <mj-column>
                <mj-text>Hello world!</mj-text>
            </mj-column>
        </mj-section>
    </mj-container>
    </mj-body>
    </mjml>
{% endmjml %}

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

django-mjml-0.1.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

django_mjml-0.1.2-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 2 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