- Author:
- ajs17
- Posted:
- February 28, 2007
- Language:
- Python
- Version:
- Pre .96
- Score:
- -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'),
)
|
More like this
- Browser-native date input field by kytta 1 month, 1 week ago
- Generate and render HTML Table by LLyaudet 1 month, 2 weeks ago
- My firs Snippets by GutemaG 1 month, 2 weeks ago
- FileField having auto upload_to path by junaidmgithub 2 months, 3 weeks ago
- LazyPrimaryKeyRelatedField by LLyaudet 3 months ago
Comments
I used to use the exact same code but then I discovered you can achieve the same by
#
Please login first before commenting.