On 12/12/2013 06:19 PM, Jonathan Baker wrote:
Django is just Python, after all, so you can use the same approach that
you would in "regular python scripts". "when a view is rendered" is a
pretty vague description of what you're aiming to profile. If your start
point is the request coming in to Django, and your stop point is the
rendered response exiting Django, then I'd write a piece of custom
middleware. If, on the other hand, you're aiming to profile a specific
method of a view (like rendering a template), then you'll want to target
the method itself. You could do this with a decorator if you're using
FBVs, or a abstract base class if you're using CBVs. This approach is
nice because you're abstracting away the profiling code which allows you
to easily reuse it.

Hope this helps a little,
JDB


--
Jonathan D. Baker
Developer
http://jonathandbaker.com


I appreciate your response, instead of using a lot of third-party apps
I have written everything on my site from scratch to get things
exactly the way I want them. I was actually hoping for a third-party
solution for this one, but if it takes me writing my own middleware
then thats just what I'll do. It is the whole request and response I
am trying to look at, but finer grain control would be good too.

Thanks again, I'm going to study up on middleware.
--

- Christopher Welborn <[email protected]>
  http://welbornprod.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/l8dtmt%241lm%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to