django-mjml
Use MJML in Django templates
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-mjmluv
uv add django-mjmlpoetry
poetry add django-mjmlInstalling 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
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
mjmlConverts MJML (a markup language for responsive…
permissive · top 15,000 on PyPI
mjml-pythonCompiles MJML email templates to HTML at…
permissive · top 15,000 on PyPI
mrmlConverts MJML (a markup language for responsive…
unclear · top 5,000 on PyPI
django-render-blockRender a specific block from a Django template…
permissive · top 15,000 on PyPI
django-debug-toolbar-template-timingsA Django Debug Toolbar panel that measures and…
unclear · top 15,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
django-debug-toolbar-template-profilerAdds a debug panel to django-debug-toolbar that…
permissive · top 15,000 on PyPI
django-templated-mailSends Django emails using template files…
permissive · top 15,000 on PyPI
cmarkgfmConverts CommonMark and GitHub-flavored…
permissive · top 15,000 on PyPI