使用PyCharm对Django进行性能分析 [英] Profiling Django with PyCharm

查看:284
本文介绍了使用PyCharm对Django进行性能分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在开发环境中,我的应用程序仍然运行缓慢,因此我想弄清楚正在降低速度的原因,以便尝试对其进行修复。

My app is pretty slow even in a dev environment so I would like to figure out what's slowing it down so I can try and fix it.

我知道调试工具栏,并根据它报告的内容,无论是数据库查询还是下载的源均不是问题,因此必须是业务逻辑。

I know about the debug toolbar and according to what it reports neither the database queries nor the downloaded sources are the issue, so it must be the business logic.

但是,我无法运行PyCharm探查器与Django服务器配合使用,因为,这不像运行脚本。

However, I cannot run the PyCharm profiler with the Django server because, well, it's not like running a script.

我如何使用PyCharm探查Django?

How may I profile Django with PyCharm?

推荐答案

您可能应该正确设置配置。

You should probably set configuration properly.

然后单击编辑配置...

最主要的是设置Interpreter(您的虚拟环境)。如果使用 python manage.py runserver

The main thing is to set Interpreter (your virtual environment). You don't have to set Custom Run Command if you use python manage.py runserver

然后,您也可以直接从 PyCharm Profiler 运行 Django服务器

Then you can run Django server directly from PyCharm ann Profiler too.

这篇关于使用PyCharm对Django进行性能分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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