On Mar 30, 5:26 am, "Milan Andric" <[EMAIL PROTECTED]> wrote:
> On Mar 28, 6:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On Wed, 2007-03-28 at 19:59 +0000, Milan Andric wrote:
> > > Hellow,
>
> > > Any advice you can offer on optimizing this view would be greatly
> > > appreciated.
>
> > >http://dpaste.com/7543/
>
> > > I was planning on trying to reduce the amount of data in pForms, the
> > > list that is passed to the template.  Since i'm saving 19
> > > presentations into this list along with the forms, i'm assuming this
> > > is the bottleneck.  Any ideas how to work around this?
>
> > Don't assume... test! You can put calls to time.time() in various places
> > in the view and then print out the differences between them to a file or
> > to stderr (or even stdout if you are using the development server). That
> > will show you which portions are taking the longest. With a few
> > iterations, moving the time.time() calls around, you should be able to
> > work out the exact lines that are taking the most time.
>
> > Then come back and we can talk.
>
> > You might discover, for example, that it's not the view that is taking
> > all the time, but the template rendering for some reason (such as making
> > a lot of database calls by constructing querysets whilst rendering the
> > template).
>
> Hi Malcolm,
>
> Thanks for your response.  I'm failing at getting any debug
> information out of the production (apache2/mod_python) environment.  I
> tried using print and  sys.stderr.write but the logs show no signs of
> it.  So there might be something broken there.  Will get to that
> later.

Under mod_python, you must explicitly call flush() on sys.stderr to
have anything appear in Apache logs promptly. Ie.,

  print >> sys.stderr, "Hi there!"
  sys.stderr.flush()

If you know you are running under mod_python, you may be better off
using:

  from mod_python import apache
  apache.log_error("Hi there!")

Graham


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to