Skip to main content

Tailwind CSS Framework for Django projects

Project description

Tailwind CSS integration for Django a.k.a. Django + Tailwind = 💚

Tests PyPI GitHub Python versions Downloads Downloads / Month

Django Tailwind Demo

Goal

This project provides a convenient way to integrate the Tailwind CSS framework into a Django project. It creates a new Django app (named theme by default) that includes all the necessary files and configurations to get started with Tailwind CSS quickly and without even needing to install Node.js if you choose the standalone binary mode.

Features

  • An opinionated Tailwind CSS setup that makes your life easier;
  • Two installation modes: standalone binary (works without Node.js) or npm-based (Node.js required);
  • Hot reloading of CSS, configuration files, and Django templates. No more manual page refreshes!
  • Out of the box support for CSS imports and nesting;
  • Supports the latest Tailwind CSS v4.x;
  • Start both Tailwind CSS and Django development servers with a single command;
  • An optional DaisyUI integration to spice up your Tailwind templates with pre-built components.
  • A convenient management command for installing Tailwind CSS plugins;

Requirements

Python 3.11 or newer and Django 4.2.20 or newer.

Note: Node.js is only required if you choose the npm-based installation. The standalone binary mode does not require Node.js.

Documentation

The full documentation is at https://django-tailwind.readthedocs.io/ or in the docs directory of this repository.

Getting Started

  1. Install django-tailwind:

    a) With all dependencies that make development easier (recommended):

    pip install 'django-tailwind[cookiecutter,honcho,reload]'
    

    b) or just the core package (enough for production use):

    pip install django-tailwind
    
  2. Add to INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        # ...
        "tailwind",
    ]
    
  3. Create Tailwind app:

    python manage.py tailwind init
    
  4. Add the generated app to INSTALLED_APPS and configure:

    INSTALLED_APPS = [
        # ...
        "tailwind",
        "theme",  # your generated app name
    ]
    
    TAILWIND_APP_NAME = "theme"
    
  5. Install Tailwind CSS dependencies:

    python manage.py tailwind install
    
  6. Start development (runs Django + Tailwind):

    python manage.py tailwind dev
    
  7. Use Tailwind classes in your templates:

    {% load tailwind_tags %}
    {% tailwind_css %}
    
    <h1 class="text-4xl font-bold text-blue-600">Hello Tailwind!</h1>
    

That's it! 🎉 Your Django project now has Tailwind CSS installed and ready to use.

For configuring automatic page reloads during development, see the Installation instructions.

Bugs and suggestions

Please see CONTRIBUTING.

2019 - 2025 (c) Tim Kamanin — A Full-Stack Django and Wagtail Developer

Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_tailwind-4.5.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_tailwind-4.5.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file django_tailwind-4.5.0.tar.gz.

File metadata

  • Download URL: django_tailwind-4.5.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_tailwind-4.5.0.tar.gz
Algorithm Hash digest
SHA256 c4b40820663ac3932f6951b82b91e3773361a46d9bde972bc8a338eee3c5d045
MD5 58b4c78b33ad82e4148e85ffeb66fa31
BLAKE2b-256 4a52a87b0d08fd786f3f4bd7686edc0d3ae5cd1906d087cf8e2c2ef8157b07d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tailwind-4.5.0.tar.gz:

Publisher: ci.yml on timonweb/django-tailwind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_tailwind-4.5.0-py3-none-any.whl.

File metadata

  • Download URL: django_tailwind-4.5.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_tailwind-4.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 618314751e867e8871b1e06ed98c0b8beb762ac9b431f739647ad4d82ab8b125
MD5 8d7be73597b44574b203c3215ff00a33
BLAKE2b-256 0932ffb8c8f6e86d06912d3afe4800e72a5045d21916171b36e256c07f87cc91

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tailwind-4.5.0-py3-none-any.whl:

Publisher: ci.yml on timonweb/django-tailwind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page