On Sun, 2007-09-16 at 11:21 -0700, msaelices wrote: > I created a ticket for it. Ticket is: > http://code.djangoproject.com/ticket/5513 > > After more than one hour of profiling, I found the problem. It creates > a session for every request. > > I've attached patch on ticket: > http://code.djangoproject.com/attachment/ticket/5513/sessions_speedup_6364.diff > > Again Django becomes fastest!
Accessing setttings at import time is a bad idea -- and that's what you're doing in that patch: you have to read settings.SESSION_ENGINE before we can finish importing that file. It means that in cases where you are doing manual configuration (via settings.configure()), you have to do that prior to importing certain modules and that leads to messy code. It also can result in settings being set in stone (once read, you should never write to settings) too early in some cases, before the environment is correctly set up. If you want to factor out the dynamic import in that code, the global should be a flag that indicates whether import is needed. You could even make engine be None initally and, inside the function, only do the import if engine is None. Malcolm -- If Barbie is so popular, why do you have to buy her friends? http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
