Srinivasreddy Jakkireddy
Srinivasreddy Jakkireddy

Reputation: 2819

Django template rendering

when i am rendering my template am getting the below error please help me any one. Thanks in advance. Note: I added sekizai.context_processors.sekizai in TEMPLATE_CONTEXT_PROCESSORS in settings file.

You must enable the 'sekizai.context_processors.sekizai' template context processor or use 'sekizai.context.SekizaiContext' to render your templates.

Upvotes: 4

Views: 2581

Answers (3)

Abhinav Anand
Abhinav Anand

Reputation: 364

for people using django 1.8 or later you need to specify the SekizaiContext if you are writing custom views.

from sekizai.context import SekizaiContext
from django.shortcuts import render_to_response

def home(request):
    vars = {'test': 'test'}
    return render_to_response('home.html', SekizaiContext(request, vars))

Upvotes: 0

Philipp Zedler
Philipp Zedler

Reputation: 1670

If your're using Django 1.8 or later and have defined the new setting TEMPLATES (see the docs), sekizai will look for the context processors there and not in TEMPLATE_CONTEXT_PROCESSORS.

Upvotes: 0

robertzp
robertzp

Reputation: 1495

Are you using your own view to render the template? If yes, and the context processor is already added to TEMPLATE_CONTEXT_PROCESSORS, check if you are using RequestContext to render your template:

from django.shortcuts import render_to_response
from django.template import RequestContext


def home(request):
    vars = {'test': 'test'}
    return render_to_response('home.html', RequestContext(request, vars))

Upvotes: 4

Related Questions