Installation ============ Requirements ------------ Python 3.10 to 3.14 supported. Django 4.2 to 6.0 supported. Installation ------------ 1. Install with **pip**: .. code-block:: sh python -m pip install django-htmx 2. Add django-htmx to your ``INSTALLED_APPS``: .. code-block:: python INSTALLED_APPS = [ ..., "django_htmx", ..., ] 3. (Optional) Add the middleware: .. code-block:: python MIDDLEWARE = [ ..., "django_htmx.middleware.HtmxMiddleware", ..., ] The middleware adds ``request.htmx``, as described in :doc:`middleware`. 4. (Optional) Update your base template to: 1. Add htmx and the django-htmx extension script to your pages with a :doc:`template tag `, available for Django templates and Jinja2. 2. Add Django’s CSRF token to all htmx requests, so POST requests work, per :ref:`this tip `. In the typical case, with Django templates: .. code-block:: django :emphasize-lines: 1,6,8 {% load django_htmx %} ... {% htmx_script %} ...