django-tailwind-cli¶
Tailwind CSS for Django without Node.js. The library downloads the standalone Tailwind CSS CLI and wires it into Django management commands, so there is no npm, no webpack, and no separate build tool to configure. It follows the approach of the Tailwind integration for Phoenix.
What it does¶
Downloads and manages the Tailwind CLI binary for your platform
Rebuilds CSS on change, running under Django’s own auto-reloader
Produces minified production builds containing only the classes you use
Includes the CSS via a
{% tailwind_css %}template tagSupports DaisyUI through tailwindcss-cli-extra
Targets Tailwind CSS 4.x
Quickstart¶
In an existing Django project, install the package:
python -m pip install django-tailwind-cli
Add the app and a static files directory to settings.py:
INSTALLED_APPS = [
# ... your other apps
"django_tailwind_cli",
]
STATICFILES_DIRS = [BASE_DIR / "assets"]
Create that directory before starting Django:
mkdir -p assets
Load the template tag in your base template and place it inside <head>:
{% load tailwind_cli %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Django App</title>
{% tailwind_css %}
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
Start Django and the Tailwind watcher together:
python manage.py tailwind runserver
The first run downloads the CLI and creates the default source CSS. Add Tailwind classes to your templates; the watcher rebuilds the stylesheet when you save them.
For a production build, run Tailwind before collecting static files:
python manage.py tailwind build
python manage.py collectstatic --noinput
See the installation guide for setup checks and optional integrations, and the workflow guide for custom CSS, editor setup and troubleshooting.
Requirements¶
Python: 3.10+
Django: 4.2 LTS, 5.2, 6.0, or 6.1
Platform: Windows, macOS, Linux (automatic platform detection)
Configuration and commands¶
The defaults work with the setup above. Optional settings let you pin the Tailwind version, use a system binary, add custom CSS, enable DaisyUI, or include editable-installed external apps. See the settings reference.
The command reference covers all commands and options. To inspect your setup or investigate a build problem, start with:
python manage.py tailwind config
python manage.py tailwind build --verbose
python manage.py tailwind troubleshoot
Contributing¶
Contributions are welcome.
CONTRIBUTING.md
covers the development setup (mise provisions Python, uv, and
pre-commit), how to run the tests, and what a pull request should look like. Please read the short
section at the top of it before opening an issue or a pull request — it explains what makes one easy
to act on.
License¶
This software is licensed under MIT license.