your two versions are actually identical :) The missing comma, I assume, was missing after django.template.loaders.app_directories.Loader ... without the comma there, python sees two strings right next to each other, and thus concatenates them, resulting in a single parameter : 'django.template.loaders.app_directories.Loaderdjango.template.loaders.filesystem.Loader'
On Tuesday, December 18, 2012 2:40:02 AM UTC-8, Tom Martin wrote: > > I had the same problem and discovered that I was missing a comma in the > settings file: > > TEMPLATE_LOADERS = ( > ('django.template.loaders.cached.Loader, ( > 'django.template.loaders.app_directories.Loader', > 'django.template.loaders.filesystem.Loader, > )) > ) > > should have been: > > TEMPLATE_LOADERS = ( > ('django.template.loaders.cached.Loader, ( > 'django.template.loaders.app_directories.Loader', > 'django.template.loaders.filesystem.Loader, > )) > ) > > Pretty subtle issue, I'm not sure how the missing comma causes it. > > On Tuesday, July 6, 2010 1:45:27 PM UTC+1, Sævar Öfjörð wrote: >> >> I've also tried passing this through >> django.shortcuts.render_to_response, but I get the same error. >> - Sævar >> >> On Jul 6, 2:41 pm, Sævar Öfjörð <saeva...@gmail.com> wrote: >> > Hi, I've been using the default template loaders and it works fine. >> > Now I want to add the cached template loader, but I get an error. >> > >> > I'm using a wrapper function to return responses that include the >> > request in the context, like this: >> > >> > # file helpers/helpers.py >> > from django.template import RequestContext, loader >> > from django.http import HttpResponse >> > >> > def return_response(request, dictionary, template, headers={}): >> > t = loader.get_template(template) >> > c = RequestContext(request, dictionary) >> > res = HttpResponse(t.render(c)) >> > for h, v in headers.iteritems(): >> > res[h] = v >> > return res >> > >> > The stacktrace: >> > >> > Traceback: >> > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ >> > django/core/handlers/base.py" in get_response >> > 106. response = middleware_method(request, >> > e) >> > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ >> > django/core/handlers/base.py" in get_response >> > 100. response = callback(request, >> > *callback_args, **callback_kwargs) >> > File "/home/django/project/project/views.py" in index >> > 24. return helpers.return_response(request, d, 'frontpage.html') >> > File "/home/django/project/project/helpers/helpers.py" in >> > return_response >> > 129. t = loader.get_template(template) >> > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ >> > django/template/loader.py" in get_template >> > 157. template, origin = find_template(template_name) >> > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ >> > django/template/loader.py" in find_template >> > 128. loader = find_template_loader(loader_name) >> > File "/home/django/project/virtualenv/lib/python2.6/site-packages/ >> > django/template/loader.py" in find_template_loader >> > 104. func = TemplateLoader(*args) >> > >> > Exception Type: TypeError at / >> > Exception Value: __init__() takes exactly 2 arguments (1 given) >> > >> > Is there some different way I should approach the template loading? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_14fNKjl3HQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.