This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

django-mjml

The simplest way to use MJML in Django templates.


Installation

Requirements:

  • Django v1.8+
  • 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 %}

Advanced settings

There are two backend modes for compiling: cmd and tcpserver.

cmd mode

This mode is very simple, slow and used by default.

MJML_BACKEND_MODE = 'cmd'
MJML_EXEC_CMD = 'mjml'

You can change MJML_EXEC_CMD and set path to executable mjml file, for example:

MJML_EXEC_CMD = '/home/user/node_modules/.bin/mjml'

tcpserver mode

This mode is faster than cmd but it needs run a server process in background.

MJML_BACKEND_MODE = 'tcpserver'
MJML_TCPSERVERS = [
    ('127.0.0.1', 28101),  # host and port
]

You can set several servers and it will be used random one:

MJML_TCPSERVERS = [
    ('127.0.0.1', 28101),
    ('127.0.0.1', 28102),
    ('127.0.0.1', 28103),
]

You can run servers by commands:

# NODE_PATH=/home/user/node_modules node /home/user/.virtualenv/default/lib/python2.7/site-packages/mjml/node/tcpserver.js 28101 127.0.0.1 /tmp/mjmltcpserver.stop

28101 - port, 127.0.0.1 - host, /tmp/mjmltcpserver.stop - file that will stop server after touch.

For daemonize server process you can use, for example, supervisor:

/etc/supervisor/conf.d/mjml.conf

[program:mjmltcpserver]
user=user
environment=NODE_PATH=/home/user/node_modules
command=node
    /home/user/.virtualenv/default/lib/python2.7/site-packages/mjml/node/tcpserver.js
    28101 127.0.0.1 /tmp/mjmltcpserver.stop
stdout_logfile=/home/user/project/var/log/supervisor/mjml.log
autostart=true
autorestart=true
redirect_stderr=true
stopwaitsecs=10
stopsignal=INT
Release History

Release History

0.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1a0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_mjml-0.2.3-py2.py3-none-any.whl (8.4 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 13, 2016
django-mjml-0.2.3.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256 Source Oct 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting