- February 28, 2007
- Pre .96
- -3 (after 3 ratings)
In your site’s settings.py module (in your site root), TEMPLATE_DIRS takes absolute paths. Here is a way to dynamically determine the absolute path to the application directory so you only have to specify relative paths within settings.py. Obviously, replace “application_directory” with the name of your application’s directory.
1 2 3 4 5
import os dirname = os.path.dirname(globals()["__file__"]) TEMPLATE_DIRS = ( os.path.join(dirname, 'application_directory/templates'), )