RequestContext direct_to_template, TEMPLATE_CONTEXT_PROCESSORS
Posted: August 5th, 2010 | Author: Davo | Filed under: Django | Tags: RequestContextdirect_to_template, TEMPLATE_CONTEXT_PROCESSORS | 4 Comments »If you are wondering why you can’t use {{ request }} in your templates while using
direct_to_template then you probably forgot to edit your TEMPLATE_CONTEXT_PROCESSORS in settings.py
The default TEMPLATE_CONTEXT_PROCESSORS is without the django.core.context_processors.request
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.request",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.contrib.messages.context_processors.messages",
)
Hope this works for you.

Thank you! Am working on Appengine and had commented that preprocessor out along with a bunch of others because AE doesn’t play nicely with some of them. Appears to work fine now that I’ve uncommented it though.
Is there a way around declaring the request as a global variable? I’m using “list_detail.object_list” to contain my “request, queryset, and template_name” in my views. Why wouldn’t I be able to access {{ request }} since it’s in the object_list that I’m returning?
I can’t access the {{ request }} in the template, and I was wondering if there was a way to pass the request to the template without doing the template_context_processors stuff.
Not true. In my case, settings.py was already with that line and still didn’t work.
See also: http://blog.madpython.com/2010/04/07/django-context-processors-best-practice/