I am a new user of Django (as well as Python) that finding the tricks
on TEMPLATE_DIRS very frustrating.

Here is the method of using relative path as written in Django Book:

import os.path

TEMPLATE_DIRS = (
    os.path.join(os.path.basename(__file__), 'templates'),
)

As usual, it doesn't work, and in the comments section somebody
suggested using os.path.dirname(__file__) instead. However I am using
windows, the path returned would be of backslashes "\" instead of "/".
So further suggestions include using TEMPLATE_DIRS =
( os.getcwd().replace("\\", "/") + '/templates/',) to overcome the
issue.

I am just sick of this kind of inconsistency in django over plain
python. As I notice it is okay to use Windows path in other situations
(however I don't know if those methods are crafted to live with
windows or not). Here is like the first time hearing UNIX based
software doesn't work with Windows paths. At least I heard I could use
File.expand_path to solve that out in Ruby, which turn all '\' into
'/' (as well as /yyy/../xxx => /xxx kind of paths)just by running that
command. I may have overlooked similar built-in function in python.

So is it possible to patch django instead of patching every single
project? Reading the code in django/template/loader.py doesn't help me
to solve that puzzle (strongly related to my newbie skill).

P.S. It is freaky to hear that django intend to read files from
absolute paths instead of using relative paths.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to