0

This is quite strange. As far as I knew, django always searches in local dir and then goes into Python installed lib dir. But this is not the case with django.contrib.comments.

I am trying to load list.html from local template director of the comments app. Its located exactly at templates/comments/list.html on local app dir.

The strange part is, it doesn't get loaded. It only loads the default one found in django.contrib.comments dir..

Why is it happening.

  1. My app is correctly configured

Since something is going wrong I thought to check whether template dir is in path or not. So, I quickly loaded

{% include "comments/list.html" %} and it showed default file (not the custom one it supposed to show)

but I just changed list.html to list1.html and it was showing.

  1. I changed the file name from list.html to list1.html and its working.
Surya
  • 4,824
  • 6
  • 38
  • 63
  • what do you mean by __I changed the file name from list.html to list1.html and its working__ ? The template path should be `/templates/comments/posted.html` – karthikr Jun 21 '13 at 21:10
  • sorry for not being clear – Surya Jun 21 '13 at 21:11
  • @karthikr Actually, I am having a custom `app` named `comments`. this file is in `templates/comments/` dir of the custom `comments` app – Surya Jun 21 '13 at 21:14
  • well, you can still override these templates in `/templates/comments/posted.html` and load the same templates from your custom apps – karthikr Jun 21 '13 at 21:23

1 Answers1

0

Make sure that your comments app appears above django.contrib.comments in your INSTALLED_APPS setting.

When you you using the app directories template loader, Django goes through your apps in the order they appear in you INSTALLED_APPS setting.

Alasdair
  • 298,606
  • 55
  • 578
  • 516