On Sun, Nov 14, 2010 at 10:34 PM, Brian <martinair.ameri...@gmail.com> wrote: > Daniel, thanks for the help!, I really appreciate it. > > Believe me, I simplified this to nothing: > > 1) I have LOGO.html in all directories with only the current directory > name in the html file (/lib = directory of LOGO.html file)
How does that help you work out the correct settings, surely you've just shotgunned your debugging process? If it does get included, how do you know which one got included? > 2) the home.html file has about 30 deferent include statements so I > can see from what directory its included the LOGO file from. ( {% > include "LOGO.html" %}, {% include "/LOGO.html" %} {% include "lib/ > LOGO.html" %} {% include "/lib/LOGO.html" %} etc.... >From a performance perspective, thats a bit nuts. > 3) I tried TEMPLATE_DIRS setting 30 ways: > Currently: > SITE_ROOT = os.path.realpath(os.path.dirname(__file__)) > TEMPLATE_DIRS = ( os.path.join(SITE_ROOT, ''), > The log file is showing the correct root path with this but I tried > coding this 20 ways, including; 'root', c:\root, /root, \\root, "../", > "lib", /lib", "/", "\\" Above TEMPLATE_DIRS in my settings.py it says this: # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. Looks like none of the things you tried conform to that. > > I hate waisting time on this as I could be more productive coding, but > I will try a new project with this on Monday, someone also said > something about Python 2.6 being better at relative paths.(I'm on 2.5 > with 1.1 of templates) > > FYI: I have no problem including .py code from all kinds of relative > paths down & up the tree. > > Thanks again. > > Yeah, it's a shame to waste time on something. Templates are not python. Changing to python 2.6 will not make you able to include templates using relative paths, it just is not possible using django templates. When you say {% include "foo/bar.html" %} what django does is to step through each value in settings.TEMPLATE_DIRS, appends the string in the include tag to the value, and checks to see if the file is present. If it is not, then it continues with the next values from settings.TEMPLATE_DIRS and so on.* Therefore, YOU should be able to work out why it isn't working. If, as you say, you only have one value in TEMPLATE_DIRS, it should be quite clear what file will get included. If the file can't be found, you even get a lovely debug message explaining exactly what paths it tried, which should make it even easier for you to work out where it is trying to include from, and you can fix your settings so they are correct. Cheers Tom * Actually, that's what the default template loader does, you can add additional loaders to settings.TEMPLATE_LOADERS which load templates in different ways, read the manual for more info. -- 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.