关于执行时间如何配置django应用程序? [英] How to profile django application with respect to execution time?

查看:183
本文介绍了关于执行时间如何配置django应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Django应用程序非常缓慢,我想知道需要花多少时间:



我尝试过 Django-debug-toolbar 但无法找到可以让我分解加载时间的面板。



我的要求:




  • 一个堆栈跟踪类型输出,每个模块执行时间都会执行,用于呈现页面。

  • 我想知道什么整个页面渲染过程的一部分正在花费时间?

  • 另外,什么部分消耗了多少CPU [最重要]?



可以 django-debug-toolbar 这样做吗? [什么面板? ]



可以这样做的任何其他django应用程序

解决方案

最后想出了一个方法来配置我的django webapp:



以下2个django片段提供中间件如果
请求在 GET键 prof >





简单和简单的分析 - 保存我的一天!


My Django application is insanely slow, I want to figure out what is taking time :

I tried Django-debug-toolbar but was unable to find a panel that can give me the break-up of the load time.

My requirements:

  • A stack-trace type output with time of execution for each module called to render the page.
  • I want to realize what part of the whole page rendering process is taking the time ?
  • Also, what part is consuming how much CPU [ MOST IMPORTANT ] ?

Can django-debug-toolbar do that ? [ What panel ? ]

Any other django-app that can do that ?

解决方案

Finally figured out a way to profile my django webapp :

Following 2 django snippets provide middleware that profile the whole flow and outputs if request has prof in GET keys :

Plain and simple profiling - Saved my day !

这篇关于关于执行时间如何配置django应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆