Methord 1 from django.http import HttpResponse from django.template import RequestContext, loader template = loader.get_template('hr/index.html') context = RequestContext(request, {'leaveRequests': leaveRequests,}) return HttpResponse(template.render(context)) Methord 2 from django.shortcuts import render from django.http import HttpResponse response = HttpResponse() response = render(request, 'hr/index.html',{'leaveRequests': leaveRequests,}) response.set_cookie(key='sampCookieKey', value=1) return response