feat(settings): Integrate Tailwind CSS CLI and browser live reload

This commit introduces `django-tailwind-cli` for simplified Tailwind CSS integration and `django-browser-reload` for automatic development server reloading. It also refines static and template file configurations.

*   **New Features**
    *   Integrated `django-tailwind-cli` into `THIRD_PARTY_APPS` for managing Tailwind CSS builds.
    *   Enabled DaisyUI with Tailwind CSS by setting `TAILWIND_CLI_USE_DAISY_UI = True`.
    *   Added `django-browser-reload` to `THIRD_PARTY_APPS` and `MIDDLEWARE` for live development reloading.
*   **Enhancements & Refinements**
    *   Configured Django `TEMPLATES` to explicitly search for templates in `BASE_DIR / "templates"`.
    *   Defined `STATICFILES_DIRS` to include `BASE_DIR / "static"` and adjusted `STATIC_URL` to `/static/`.
    *   Removed `django_components` from `THIRD_PARTY_APPS`.
This commit is contained in:
sankalp committed 2025-12-14 05:25:31 +05:45
1 parent fdb7255af3
commit 8728ddeafc
1 file changed
+10 -3
+10 -3
View File
@@ -22,10 +22,11 @@ ADMINS = [("Admin", env("ADMIN_EMAIL", default="admin@example.com"))]
MANAGERS = ADMINS
THIRD_PARTY_APPS = [
"django_components",
"django_htmx",
"phonenumber_field",
"babel",
"django_tailwind_cli",
"django_browser_reload",
]
USER_DEFINED_APPS = [
@@ -53,6 +54,7 @@ MIDDLEWARE = [
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django_browser_reload.middleware.BrowserReloadMiddleware",
]
ROOT_URLCONF = "src.urls"
@@ -60,7 +62,7 @@ ROOT_URLCONF = "src.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
@@ -103,8 +105,9 @@ USE_I18N = True
USE_TZ = True
# Static files and media files
STATIC_URL = "static/"
STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_DIRS = [BASE_DIR / "static"]
MEDIA_URL = "media/"
MEDIA_ROOT = BASE_DIR / "media"
@@ -112,3 +115,7 @@ MEDIA_ROOT = BASE_DIR / "media"
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Tailwind CSS
TAILWIND_CLI_USE_DAISY_UI = True