skillfed

django-mjml

Use MJML in Django templates

django-mjml v1.5 101.3K downloads/30d#12,949 on PyPI284
Permissive license MIT Active released

What it is and what it does

django-mjml is a Django app that lets you write responsive email templates using MJML (Mailjet Markup Language) directly in your Django templates. Instead of hand-coding complex HTML email layouts, you write simpler MJML markup and the package compiles it to production-ready HTML at render time. It acts as a bridge between Django's template system and the MJML compiler, handling the compilation process transparently.

The package supports three rendering backends: a simple command-line mode (default, slower), a faster TCP-server mode for high-volume rendering, and an HTTP-server mode that can use the official MJML API or your own HTTP server. You configure which backend to use in Django settings, and the template tag remains the same. It requires Django 2.2 to 6.0 and Python 3.9+, with no other mandatory runtime dependencies beyond django itself.

Use it for:

  • Render responsive email templates in Django views without writing raw HTML table layouts.
  • Build reusable MJML email components as Django template includes for consistent branding across transactional emails.
  • Scale email rendering by switching from cmd mode to tcpserver or httpserver mode as volume grows.
  • Integrate MJML templates into Django's email backend for automated password-reset and notification emails.
  • Validate email HTML output during development by leveraging MJML's built-in validation and minification options.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Django template tag that compiles MJML (Mailjet Markup Language) to HTML, supporting multiple rendering backends including command-line, TCP server, and HTTP API modes.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a real problem—writing responsive emails is tedious without a markup language designed for it. Use it if you need to generate HTML emails in Django and want to avoid hand-coding complex table layouts. The multiple rendering backends let you start simple and scale later.

Install

django-mjml on PyPI

pip

pip install django-mjml

uv

uv add django-mjml

poetry

poetry add django-mjml

Installing django-mjml

Before you install

Low friction installation with a single runtime dependency (django). Actively maintained with recent releases; last commit 2026-08-14. Requires external mjml installation and optionally requests library for HTTP-server mode.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.

Quickstart

pip install django-mjml

# In settings.py:
INSTALLED_APPS = (..., 'mjml')

# In template:
{% load mjml %}
{% mjml %}
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text>Hello world!</mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
{% endmjml %}

Requires mjml (version 4.14.1 to 4.17.2) to be installed separately on the system; see https://github.com/mjmlio/mjml#installation. Optionally requires requests (2.24.0+) for HTTP-server rendering mode.

Verify before relying

  • Whether the package's three backend modes (cmd, tcpserver, httpserver) have measurable performance differences in production workloads.
  • Whether MJML_CHECK_CMD_ON_STARTUP=False actually provides meaningful startup speedup in typical deployments.
  • Compatibility testing status with Django 6.0 (listed as supported but package last released 2025-12-07).

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — django
Maintenance actively maintained — 250 days since the last release
Last repo commit
First released
Downloads 101,269/month — #12,949 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_mjml-1.5-py3-none-any.whl

Keywords: django, mjml, django-mjml, email, layout, template, templatetag

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules

Tags

django mjml template tagmjml email templates djangoresponsive email markup djangomjml html compiler djangoemail template rendering djangomjml to html djangomailjet markup language django
email-templatesmjmldjango-app

More Libraries packages