Django TEMPLATE_CONTEXT_PROCESSORS Not Working
Firstly, if you are not using SSL for all your sites, you should step it up! NameCheap's
SSL certificates
start at only $9. There's no excuse!
Firstly, if you have not tried Digital Ocean's
SSD Virtual Servers
for only $5/mo, I highly recommend them!
One thing that django’s docs fail to clearly state is that to use Template Context Processors, you need to use a RequestContext when rendering your template. If you don’t, you’ll wonder why your context processing function is not getting called.
This won’t work:
from django.shortcuts import render_to_response
def myview(request):
return render_to_response("index.html", {})
But this will:
from django.shortcuts import render_to_response
from django.template import RequestContext
def myview(request):
return render_to_response("index.html", {}, context_instance=RequestContext(request))

Comments are closed
Comments are currently closed on this entry.