pistacchio
pistacchio

Reputation: 58923

django.core.context_processors.request not being added

This is defined in my settings.py

TEMPLATE_CONTEXT_PROCESSOR = (
     "django.core.context_processors.request", # <- HERE
     "django.contrib.auth.context_processors.auth",
     "django.core.context_processors.debug",
     "django.core.context_processors.i18n",
     "django.core.context_processors.media",
     "django.core.context_processors.static",
     "django.core.context_processors.tz",
     "django.contrib.messages.context_processors.messages",
)

And this is in my view file:

def home(request):
     ctx = {}
     request.session['test'] = 1
     return render(request, 'home.html', ctx)
     # return render_to_response('home.html', ctx, 
     #                            context_instance=RequestContext(request))

If I try to access the request object from the template (for example {{ request.session.test }}, nothing is shown. Django debug toolbar shows that in the CONTEXT_PREPROCESSOR django.core.context_processors.request is not added. Any help? Thanks

Upvotes: 0

Views: 792

Answers (1)

Alasdair
Alasdair

Reputation: 309039

You're missing an 's'. You should define TEMPLATE_CONTEXT_PROCESSORS in your settings file.

Upvotes: 5

Related Questions