Thanks Phang, I have not yet checked into the query caching in django. Will check and will see if it would improve the performance. Thanks a lot for your reply :)
Thanks and Regards, Swaroop Shankar V On Sat, Apr 7, 2012 at 4:04 PM, Phang Mulianto <braveh...@gmail.com> wrote: > Well.. i think the lazy query is on action. > > The query executed to get the data from database to be use in your view, > if you said requestContext(..) > > if you remove it, of course the data will not available in your > view/template. > > To reduce the query executed everytime you call the page, try use query > caching.. > one quick way without change code is use some cache like johnny-cache..it > will automaticly cache your query and unvalidate it if your data changes. > > i used it to.. and try load your page more than once, you will see in the > debug toolbar, the query is reduced in the second and next load...that is > the cache in action.. > > hope help.. > > On Thu, Apr 5, 2012 at 3:41 PM, Swaroop Shankar V <swaroo...@gmail.com>wrote: > >> Hi All, >> Am developing a site using django and it is almost ready to be launched. >> Right now am trying to optimize the performance of the site. I have >> installed the django debug toolbar and when i checked the number of queries >> being exicuted on the homepage i could see there are 74 queries >> being executed. On debugging I could see that most of the queries are >> through the context_instance=RequestContext(request) that am passing to a >> view. When I removed it I could see the queries where reduced to 24, which >> improved the performance, but I end up in an error >> >> Caught KeyError while rendering: 'request' >> >> this is happening because the homepage is rendering a custom template tag >> which requires the request object available (to access the currently logged >> in user details). So is there any way to avoid using >> context_instance=RequestContext(request) and still make the request object >> accessible in the custom template tag? >> >> >> >> Thanks and Regards, >> Swaroop Shankar V >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.