Use setuptools more aggressively for templates
|Reported by:||Michael Twomey <micktwomey@…>||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Locating templates provides the major source of my problems in setting up new django sites from a source checkout. Since most of my templates are closely associated with the python code in the apps it makes sense for me to use setuptools' resource location abilities to find templates.
For example in myproject/settings/admin.py:
from pkg_resources import resource_filename
TEMPLATE_DIRS = (
It would be really nice if this approach was encouraged as it would remove most of the problems for first time users setting up their sites. In fact, if django tried a set of standard locations for templates using resource_filename it should allow people to setup django sites easily just by checking out python modules and adding them to the INSTALLED_APPS. For example myproject/apps/myapp/templates could be a useful default. PS this issue gets a submitter-just-drank-5-pints-of-guinness rating in terms of coherence, try me tomorrow for more elaboration.