On Mon, Nov 15, 2010 at 2:42 PM, Brian <martinair.ameri...@gmail.com> wrote:
> Tom, Thanks again.
>
> If so, stop trying - you cannot do -->  just to be clear:
> I like to do this:
> src
> ├── settings.py
> │
> ├── templates
> │   ├── logos
> │   │   ├── logo1.html
> │   │   └── logo2.html
> │   └── titles
> │       ├── title1.html
> │       └── title2.html
> ├── main
> │   ├── page.html <-- in here I like to say {% include "../templates/
> logos/logo1.html" %} or {% include "templates/logos/logo1.html" %}
> │   └── start.py (runs application and calls page.html)
>
>
> Thanks Brian
>
>
>

OK, this is starting to make more sense. You cannot include relative
paths, but you dont need to (your second include is almost right,
'templates' is part of the TEMPLATE_DIR ).

Your TEMPLATE_DIRS should be set to something like this:

import os.path
SRC_ROOT = os.path.split(os.path.realpath(__file__))[0]
TEMPLATE_DIRS = (
    os.path.join(SRC_ROOT, 'templates'),
    os.path.join(SRC_ROOT, 'main'),
)

Then when you say '{% include "logos/logo1.html" %}, it will look for
"src/main/logos/logo1.html", find it is not there and then look for
"src/templates/logos/logo1.html", which is there and so gets included.

Cheers

Tom

-- 
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