I am using the os module to have relative paths in my Django projects settings.py
file. The variable SITE_ROOT is set to the current working directory of the settings.py
file and then used to reference all of the static/media
directories also located in that same directory.
Heres my issue:
print os.getcwd()
print os.path.abspath(os.path.dirname(__file__))
In settings.py, the above statements both have identical outputs. but my template will only load if I use SITE_ROOT = os.path.abspath(os.path.dirname(__file__))
Django looks for the templates here:
TEMPLATE_DIRS = (
os.path.join(SITE_ROOT, 'templates'),
)
SITE_ROOT set to os.getcwd()
seems to make Django look for the templates folder in the directory ABOVE the settings.py
file
I can just as easily not use os.getcwd()
and my site runs fine, but I am curious what may be going on here :)
Anyone know?