{"id":15117193,"url":"https://github.com/liminspace/django-mjml","last_synced_at":"2025-04-12T18:44:43.981Z","repository":{"id":7422500,"uuid":"56346915","full_name":"liminspace/django-mjml","owner":"liminspace","description":"The simplest way to use MJML in Django templates.","archived":false,"fork":false,"pushed_at":"2024-08-27T01:17:33.000Z","size":152,"stargazers_count":270,"open_issues_count":4,"forks_count":35,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-03T20:12:57.624Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liminspace.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-15T20:09:49.000Z","updated_at":"2025-03-15T22:07:11.000Z","dependencies_parsed_at":"2024-01-08T15:05:30.907Z","dependency_job_id":"b1226097-a611-4070-816f-9688e5400220","html_url":"https://github.com/liminspace/django-mjml","commit_stats":{"total_commits":165,"total_committers":4,"mean_commits":41.25,"dds":0.5454545454545454,"last_synced_commit":"181352f2b4bac1b4cfebc660b5d782de95ffc976"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liminspace%2Fdjango-mjml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liminspace%2Fdjango-mjml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liminspace%2Fdjango-mjml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liminspace%2Fdjango-mjml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liminspace","download_url":"https://codeload.github.com/liminspace/django-mjml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617200,"owners_count":21134190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T01:45:51.728Z","updated_at":"2025-04-12T18:44:43.973Z","avatar_url":"https://github.com/liminspace.png","language":"Python","funding_links":[],"categories":["Tools","Python"],"sub_categories":[],"readme":".. image:: https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg\n :target: https://stand-with-ukraine.pp.ua\n :alt: Stand With Ukraine\n\n|\n\n.. image:: https://github.com/liminspace/django-mjml/actions/workflows/test.yml/badge.svg?branch=main\n :target: https://github.com/liminspace/django-mjml/actions/workflows/test.yml\n :alt: test\n\n.. image:: https://img.shields.io/pypi/v/django-mjml.svg\n :target: https://pypi.org/project/django-mjml/\n :alt: pypi\n\n|\n\n.. image:: https://cloud.githubusercontent.com/assets/5173158/14615647/5fc03bf8-05af-11e6-8cdd-f87bf432c4a2.png\n  :target: #\n  :alt: Django + MJML\n\ndjango-mjml\n===========\n\nThe simplest way to use `MJML \u003chttps://mjml.io/\u003e`_ in `Django \u003chttps://www.djangoproject.com/\u003e`_ templates.\n\n|\n\nInstallation\n------------\n\nRequirements:\n^^^^^^^^^^^^^\n\n* ``Django`` from 2.2 to 5.2\n* ``requests`` from 2.24.0 (only if you are going to use API HTTP-server for rendering)\n* ``mjml`` from 4.7.1 to 4.15.2 (older version may work, but not tested anymore)\n\n**\\1\\. Install** ``mjml``.\n\nFollow https://github.com/mjmlio/mjml#installation and https://documentation.mjml.io/#installation to get more info.\n\n**\\2\\. Install** ``django-mjml``. ::\n\n  $ pip install django-mjml\n\nIf you want to use API HTTP-server you also need ``requests`` (at least version 2.24)::\n\n    $ pip install django-mjml[requests]\n\nTo install development version use ``git+https://github.com/liminspace/django-mjml.git@main`` instead ``django-mjml``.\n\n**\\3\\. Set up** ``settings.py`` **in your django project.** ::\n\n  INSTALLED_APPS = (\n    ...,\n    'mjml',\n  )\n\n|\n\nUsage\n-----\n\nLoad ``mjml`` in your django template and use ``mjml`` tag that will compile MJML to HTML::\n\n  {% load mjml %}\n\n  {% mjml %}\n      \u003cmjml\u003e\n          \u003cmj-body\u003e\n              \u003cmj-section\u003e\n                  \u003cmj-column\u003e\n                      \u003cmj-text\u003eHello world!\u003c/mj-text\u003e\n                  \u003c/mj-column\u003e\n              \u003c/mj-section\u003e\n          \u003c/mj-body\u003e\n      \u003c/mjml\u003e\n  {% endmjml %}\n\n|\n\nAdvanced settings\n-----------------\n\nThere are three backend modes for compiling: ``cmd``, ``tcpserver`` and ``httpserver``.\n\ncmd mode\n^^^^^^^^\n\nThis mode is very simple, slow and used by default.\n\nConfigure your Django::\n\n  MJML_BACKEND_MODE = 'cmd'\n  MJML_EXEC_CMD = 'mjml'\n\nYou can change ``MJML_EXEC_CMD`` and set path to executable ``mjml`` file, for example::\n\n  MJML_EXEC_CMD = '/home/user/node_modules/.bin/mjml'\n\nAlso you can pass addition cmd arguments, for example::\n\n  MJML_EXEC_CMD = ['node_modules/.bin/mjml', '--config.minify', 'true', '--config.validationLevel', 'strict']\n\nOnce you have a working installation, you can skip the sanity check on startup to speed things up::\n\n  MJML_CHECK_CMD_ON_STARTUP = False\n\ntcpserver mode\n^^^^^^^^^^^^^^\n\nThis mode is faster than ``cmd`` but it needs the `MJML TCP-Server \u003chttps://github.com/liminspace/mjml-tcpserver\u003e`_.\n\nConfigure your Django::\n\n  MJML_BACKEND_MODE = 'tcpserver'\n  MJML_TCPSERVERS = [\n      ('127.0.0.1', 28101),  # the host and port of MJML TCP-Server\n  ]\n\nYou can set several servers and a random one will be used::\n\n  MJML_TCPSERVERS = [\n      ('127.0.0.1', 28101),\n      ('127.0.0.1', 28102),\n      ('127.0.0.1', 28103),\n  ]\n\nhttpserver mode\n^^^^^^^^^^^^^^^\n\n  don't forget to install ``requests`` to use this mode.\n\nThis mode is faster than ``cmd`` and a bit slower than ``tcpserver``, but you can use official MJML API https://mjml.io/api\nor run your own HTTP-server (for example https://github.com/danihodovic/mjml-server) to render templates.\n\nConfigure your Django::\n\n  MJML_BACKEND_MODE = 'httpserver'\n  MJML_HTTPSERVERS = [\n      {\n          'URL': 'https://api.mjml.io/v1/render',  # official MJML API\n          'HTTP_AUTH': ('\u003cApplication ID\u003e', '\u003cSecret Key\u003e'),\n      },\n      {\n          'URL': 'http://127.0.0.1:38101/v1/render',  # your own HTTP-server\n      },\n  ]\n\nYou can set one or more servers and a random one will be used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliminspace%2Fdjango-mjml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliminspace%2Fdjango-mjml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliminspace%2Fdjango-mjml/lists"}