skillfed

django-htmx

Extensions for using Django with htmx.

django-htmx v1.29.0 1.7M downloads/30d#3,667 on PyPI2,003
Permissive license MIT Active released

What it is and what it does

django-htmx bridges Django and htmx by providing server-side utilities to work with htmx's request patterns and response headers. It handles the integration layer that lets Django developers detect and respond to htmx requests, manage partial page updates, and leverage htmx's lightweight interactivity model within a Django application.

The package sits between Django's request/response cycle and htmx's client-side behavior, offering helpers to inspect incoming htmx requests and craft appropriate responses. It depends on Django and asgiref, integrating naturally into existing Django projects without requiring external services or complex setup.

Use it for:

  • Build dynamic form validation and submission without full page reloads using htmx and Django views
  • Implement progressive enhancement in Django templates by adding htmx attributes and handling partial renders
  • Create real-time UI updates in Django dashboards by responding to htmx swap requests
  • Add lightweight interactivity to Django applications without committing to a heavy JavaScript framework

Worth the install?

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

Provides Django integration utilities for htmx, enabling server-side support for htmx attributes and request handling within Django applications.

Yes. Active maintenance, no known vulnerabilities, permissive MIT license, and low install friction make it a safe choice. Suitable for Django projects targeting modern Python versions that want to integrate htmx without framework overhead.

Install

django-htmx on PyPI

pip

pip install django-htmx

uv

uv add django-htmx

poetry

poetry add django-htmx

Installing django-htmx

Before you install

Low install friction with a pure Python wheel. Actively maintained with a release 9 days ago and 2003 repository stars. Requires Django and asgiref as runtime dependencies.

License in practice

MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects.

Quickstart

pip install django-htmx

import django_htmx

# In Django view, detect htmx requests
if request.htmx:
    return render(request, 'partial.html')

Requires Python 3.10 or later and Django 5.2+ as runtime dependencies.

Verify before relying

  • Specific htmx features or request attributes the package exposes beyond basic integration
  • Whether middleware is required or optional for core functionality
  • Performance characteristics when handling high-volume htmx requests

Package facts

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

Evidence: django_htmx-1.29.0-py3-none-any.whl

Keywords: Django

Development Status :: 5 - Production/StableFramework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTyping :: Typed

Tags

django htmx integrationhtmx django supportserver-side htmxdjango ajax with htmxhtmx request handlingdjango htmx extensionshtmx attributes django
django-integrationhtmxinteractive-ui

More Dynamic Content packages

MarkupSafe

MarkupSafe provides a text object that escapes…

permissive · top 100 on PyPI

Jinja2

Jinja2 is a templating engine that renders…

permissive · top 100 on PyPI

soupsieve

Soupsieve is a CSS selector library designed to…

permissive · top 100 on PyPI

Werkzeug

Werkzeug is a WSGI utility library providing…

permissive · top 1,000 on PyPI

Flask

Flask is a lightweight WSGI web application…

permissive · top 1,000 on PyPI

Mako

Mako compiles Python-embedded templates into…

permissive · top 1,000 on PyPI

litestar-htmx

Integrates HTMX into Litestar web applications,…

permissive · top 5,000 on PyPI

django-datatables-view

Provides a Django view base class that handles…

permissive · top 15,000 on PyPI

dj-datatables-view

Provides a Django base view for server-side…

permissive · top 15,000 on PyPI

django-markdownx

Django MarkdownX provides a Markdown editor…

permissive · top 15,000 on PyPI

django-admin-inline-paginator-plus

Adds pagination to Django admin inline forms,…

permissive · top 15,000 on PyPI

jinja2-fragments

Renders individual Jinja2 template blocks as…

permissive · top 15,000 on PyPI

python-fasthtml

FastHTML is a Python web framework that builds…

permissive · top 5,000 on PyPI

django-unfold

Replaces Django's default admin interface with…

permissive · top 5,000 on PyPI

django-stubs-ext

Provides runtime monkey-patching extensions for…

permissive · top 5,000 on PyPI

djangorestframework-datatables

Adds server-side Datatables support to Django…

permissive · top 15,000 on PyPI