1. Chris Moffitt
  2. satchmo


Clone wiki

satchmo / TemplateGuide

In the default Satchmo settings.py, our template loaders are:

TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', )

These two template loaders look for the templates in two different ways. The first one, the filesystem loader, looks for the templates in the directories you tell it in your settings_local.py file:

TEMPLATE_DIRS = ('/path/to/your/templates',)

The second loader, the app_directories loader, looks for the templates in a directory named "templates" in application directories.

Any time the system tries to find a template, it follows the order given above. First it asks the filesystem loader to look in the directories it has been given. If it finds the template there, it returns that one. Next it asks the app_directories loader to look in the app directories for that template. These are the "fallback" templates to use.

So, to use your "product" example, say you wanted to override the default category page template. That lives at "satchmo/apps/product/templates/product/category.html" It is found by the app_directory loader if the filesystem loader doesn't find it.

Knowing that, you can tell that the proper place to put your overridden template is at: /path/to/your/templates/product/category.html"

Make sense? You just chop the directory tree off at the word "templates" and build your override tree that way.

Another example, to override the wishlist index page, which usually lives at: "satchmo/apps/satchmo_ext/wishlist/templates/index.html"

You would make a directory "wishlist/templates" and put an index.html file in it.