3๐
โ
Use python to get current directory and call a join on it with whatever you need to add. This will make it cross platform as python will take care of converting backslashes and forward slashes for you.
import os
CURRENT_DIR = os.path.dirname(__file__)
TEMPLATE_DIRS = (
os.path.join(CURRENT_DIR, 'templates')
)
That will save you on typing and the path will be correct. If you look in settings.py that django generates it will tell you to always use / even on Windows.
# 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.
One last thing, your urls should use forward slashes because that is how django is going to use them.
Hope that helps
๐คChris McKnight
Source:stackexchange.com