Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Side Note: Templates for django-cotton not getting picked up by the watcher #147

Open
Naude555 opened this issue Jan 28, 2025 · 1 comment

Comments

@Naude555
Copy link
Contributor

Any HTML files in the templates/ directory under the project root are not being picked up. This is likely due to my custom setup, where the settings files are nested deeper in the directory structure than usual.

project_root/
    templates/
        base/
            not_pickedup.html
    config/
        django/
            base_settings.py
            dev.py
            prod.py
    accounts/
        templates/
            picked_up.html

To resolve this, add

BASE_DIR / "templates"

to your TEMPLATES setting to force it:

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent.parent

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [
            BASE_DIR / "templates",
        ],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]
@oliverandrich
Copy link
Member

I think this will be solved with Tailwind CSS 4.0 any, which doesn't use these explicit collection dirs. But I will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants