I have noticed that the first app in my INSTALLED_APPS tuple overrides
all of the others for an ambiguous template name. "accounts" does not
have one, but "dashboard" does, which is why I am seeing what I am
seeing (if I place "ads" above "dashboard", the "ads" template
precedes all others). I thought that an app's view would check its own
templates directory before any others but I guess I was wrong...is
there a way to override this default top-down lookup behavior? Or some
way to specify my template with greater precision while keeping the
"index.html" filename?

Thanks,
Thomas

On Apr 28, 5:19 pm, Thomas Allen <thomasmal...@gmail.com> wrote:
> Hi everyone,
>
> In my "pages" app, I have the following view function which renders
> index.html:
>
> @login_required
> def index(req):
>     return render_to_response(
>       'index.html',
>       context_instance=RequestContext(req)
>     )
>
> What really has me stuck here is that it doesn't render pages/
> templates/index.html, instead it renders dashboard/templates/
> index.html. This is not consistent with the lookup order I have seen
> in backtraces for missing templates, where the calling app's directory
> is the first one checked. I have verified that the correct view
> function is being called, so this doesn't seem like a URL issue to me.
>
> Up to this point, all of my templates have been located as I would
> expect them to be, so hopefully this is a minor rather than a major
> issue with my application.
>
> Here is my directory structure:
>
> % find . -type d
> .
> ./accounts
> ./accounts/templates
> ./ads
> ./ads/templates
> ./dashboard
> ./dashboard/templates
> ./db
> ./media
> ./media/templates
> ./pages
> ./pages/templates
> ./static
> ./static/css
> ./templates
> ./templates/layouts
> ./templates/registration
>
> And here are some settings which I think might be relevant:
>
> INSTALLED_APPS = (
>   'pnc.accounts',
>   'pnc.dashboard',
>   'pnc.ads',
>   'pnc.media',
>   'pnc.pages',
>
>   'django.contrib.admin',
>   'django.contrib.admindocs',
>   'django.contrib.auth',
>   'django.contrib.contenttypes',
>   'django.contrib.sessions',
>   'django.contrib.sites'
> )
>
> TEMPLATE_LOADERS = (
>   'django.template.loaders.filesystem.load_template_source',
>   'django.template.loaders.app_directories.load_template_source'
> )
>
> MIDDLEWARE_CLASSES = (
>   'django.middleware.common.CommonMiddleware',
>   'django.contrib.sessions.middleware.SessionMiddleware',
>   'django.contrib.auth.middleware.AuthenticationMiddleware'
> )
>
> TEMPLATE_DIRS = (
>   os.path.join(BASEDIR, 'templates')
> )
>
> Thanks,
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to