It's been noted serveral times that the Template engine is too closely tied to the settings, which in turn is too closely tied to the core. No one has offered a well made and clearly defined solution as to how to really seperate it, to the best of my knowledge.
This should be discussed. Aside: I think we need some leadership on a few of these key issues. I am not in the position to take on the role On 10/23/06, Le Roux Bodenstein <[EMAIL PROTECTED]> wrote: > > I'm trying to do some form of skinning with Django's templating engine. > Without going into too much detail, my project is kindof a service that > powers multiple sites. Each site can have a skin inside a site-specific > folder. These folders are not parallel to each other. > > for example: > > myapp/webroot/media/domainone.com/myskin/ > myapp/webroot/media/domaintwo.com/otherskin/ > > These folders contain templates. I want to be able to (at runtime) > specify this folder to the template engine. This means adding them all > to TEMPLATE_DIRS is a definite no. I was looking at the documentation > and the code and it doesn't look like this will work. Workarounds like > specifying a long path as the template name > (folder/subfolder/someotherfolder/template.html) will not work, because > these sites should not be able to access each other's templates. > > The main things I am looking for are.. Can I load the template from an > arbitrary folder? Will extends work correctly and load the template > we're inheriting from from that same folder? > > I see that ExtendsNode can take a template_dirs argument, but this > defaults to None and it looks like it never gets passed in. > > find_template_source can also take a dirs argument, but this also > defaults to None and inside filesystem.get_template_sources this > defaults to TEMPLATE_DIRS (from what I can tell this is always the > case) and in app_directories.get_template_sources this is ignored > completely. > > Basically, from what I can tell, the Django template engine is very > (probably too) tightly tied to the settings module and the little bits > that imply otherwise are a misleading. > > Please correct me if I'm wrong about this. Has anyone else thought > about it? Does anyone have ideas on how to fix it or at least work > around it? > > I guess I can try and set TEMPLATE_DIRS at runtime, but that just feels > wrong. I'll have to set it back in a multi-process environment and in a > multi-threaded environment that would probably be a very bad idea. (I'm > just guessing. Please correct me if I'm wrong) > > I don't mind patching the source code, but it would be nice if someone > helps me out and my patches ultimately get accepted, because I would > prefer not to maintain a branch ;) > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---