Message from discussion Fixing app_label
Date: Sun, 9 Dec 2007 18:42:32 -0800 (PST)
Received: by 10.100.123.4 with SMTP id v4mr212200anc.1197254552548; Sun, 09
Dec 2007 18:42:32 -0800 (PST)
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:18.104.22.168)
Gecko/20071204 Ubuntu/7.10 (gutsy) Firefox/22.214.171.124,gzip(gfe),gzip(gfe)
Subject: Re: Fixing app_label
From: SmileyChris <smileych...@gmail.com>
To: Django developers <email@example.com>
Content-Type: text/plain; charset=ISO-8859-1
On Dec 10, 2:41 pm, Gary Wilson <gary.wil...@gmail.com> wrote:
> The current app_directories template loader has always bugged me because it is:
> 1) inefficient - all application template directories are added as global
> template directories and are searched each time by the template loader.
> 2) unpredictable - any application could, unbeknownst to the developer,
> override another application's templates. For example, an application could
> include an "admin" directory in its "templates" directory that overrides admin
> 3) not DRY - just silly I have to make my "templates" directory one level
> deeper with a duplicated name.
> For those of you that have stopped using the app_directories loader in favor
> of the standard filesystem loader and TEMPLATE_DIRS, what was your reasoning
> behind doing so?
> And doesn't doing things this was cause the same problems? Every directory
> added is going to get searched as a global template directory. You're still
> going to have the unpredictability of apps possibly overriding templates of
> other apps. You are still going to be repeating yourself by having to put the
> app in INSTALLED_APPS and its template directory in TEMPLATE_DIRS.
> I have always thought that you should be able to put an app's templates in its
> "templates" directory and that those templates should only be accessible when
> using the app name in front of it, like "myblogapp/base.html". The
> "myblogapp/templates" directory should not be looked at in any other case, and
> only global template directories are looked at every time by the filesystem
> template loader.
You're not forced to use the app_directories loader. I'm sure some
people are using it in their project specifically for overriding admin
What you're proposing is a separate loader. It sounds easily doable
(and like a reasonable idea).
I'd suggest it just uses a "local_templates" directory or similar