Hi,

I have a framework on a product that allows new django projects to make use of
an existing project's code, so new projects can reduce duplication. It does
this in templates by some trickery with the TEMPLATE_DIRS.

For example, I have a base project here

/var/www/django/base/templates/base.html
                              /500.html
                              /404.html

And then a project making use of it like so

/var/www/django/project1/templates/index.html

{% extends "base/templates/base.html" %}

And a TEMPLATE_DIRS of
(
    "/var/www/django",
    "/var/www/django/project1/templates"
)

In my main project, this works well. And, when there's a fatal error and my
servererror view function says to render "base/templates/500.html", everything
works. 

500.html extends base.html, which is a key point. That has always worked in
the past even though the /var/www/django/base/templates directory is not in
the path. I always thought that it was a feature that 500.html could extend
base.html and it worked because they were in the same directory together.

And, it does work in project1. But, I just added a project2, configured
identically AFAICT, and it's not working. When I try to render 500.html I get

  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/shortc
uts/__init__.py", line 20, in render_to_response
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/loader.py", line 108, in render_to_string
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/__init__.py", line 178, in render
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/__init__.py", line 779, in render
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/__init__.py", line 792, in render_node
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/loader_tags.py", line 71, in render
  File "/var/tmp/Django-1.1.1-root/usr/lib/python2.4/site-packages/django/templa
te/loader_tags.py", line 66, in get_parent
TemplateSyntaxError: Template u'base.html' cannot be extended, because it doesn'
t exist

So, should this work? Is it a fluke that it works in one project and not the
other? If it should work, then some clues for helping figure out why it's not
working would be appreciated. 

Thanks,
Mike
-- 
Michael P. Soulier <msoul...@digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein

Attachment: signature.asc
Description: Digital signature

Reply via email to