--- id: django-htmlmin version: "0.11.0" license: unclear license_treatment: permissive maintenance: abandoned --- # django-htmlmin — HTML minifier for Python frameworks (not only Django, despite the name). License: permissive · Maintenance: abandoned · Downloads: 906.3K/mo ## What it is and what it does django-htmlmin is an HTML minifier that strips whitespace, newlines, and optionally comments from HTML markup to reduce payload size. It integrates with Django via middleware or decorators, works standalone with other Python web frameworks via a direct function call, and includes a command-line tool for static files. The middleware can be configured to minify selectively by URL pattern and respects Django's DEBUG setting by default. The package has no runtime dependencies and is lightweight, but it is abandoned: the last release was 2019-03-18, and the declared support covers only Django 1.11–2.1 and Python 2.7–3.7—all now end-of-life. While the minification logic itself may still work, there is no active maintenance, no testing against modern versions, and no guarantee of compatibility with current Django or Python releases. Use it for: - Reduce HTML response size in production Django deployments by automatically minifying rendered templates via middleware. - Minify static HTML files in build or deployment scripts using the command-line tool without a web framework. - Selectively minify specific views by wrapping them with the html_minify() function. - Exclude sensitive URLs from minification using regex patterns in EXCLUDE_FROM_MINIFYING. - Preserve HTML comments during minification by setting KEEP_COMMENTS_ON_MINIFYING to True. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Minifies HTML by removing whitespace and comments, reducing response size for faster client-side load times. Works as Django middleware, a decorator, a standalone function, or a command-line tool. No. The package is abandoned (no releases since 2019-03-18) and its declared support covers only obsolete Django and Python versions. While the core minification logic may still function, there is no active maintenance, no testing against modern frameworks, and no assurance of correctness or security. For a maintained alternative, consider a current web framework's built-in optimization features. ## Install pip install django-htmlmin uv add django-htmlmin poetry add django-htmlmin ## Installing django-htmlmin Before you install: High install friction: the package is abandoned (last release 2019-03-18, no activity for 2706 days). Classifiers list Django 1.11–2.1 and Python 2.7–3.7, all now unsupported. No runtime dependencies, but compatibility with modern Django and Python versions is unverified. License in practice: Distributed under BSD-style license (permissive). No restrictions on commercial or private use, but you should verify the LICENSE file matches your compliance requirements. Quickstart: # Django middleware setup MIDDLEWARE_CLASSES = ( 'htmlmin.middleware.HtmlMinifyMiddleware', 'htmlmin.middleware.MarkRequestMiddleware', ) HTML_MINIFY = True # Or standalone function from htmlmin.minify import html_minify minified = html_minify('