分析Django webserver以获得高启动时间

时间:2011-03-27 18:43:52

标签: django performance profiling webserver startup

我注意到manage.py runserver需要花费大量时间来启动我正在开发的Django项目的开发Web服务器。我想知道是否有办法了解启动的哪个部分需要如此多的资源,最终能够收集足够的信息来解决问题。

任何人都知道我该怎么做?

2 个答案:

答案 0 :(得分:10)

我找到了一个简单而有效的解决方案:

python -m cProfile manage.py runserver > profiled

有关Python分析器的更多详细信息here(官方文档)。

我还发布了video introduction to Python profiling及相关工具(PyCon 2009)的链接

答案 1 :(得分:0)

使用Vagrant时,请将virtualenv文件夹移离/vagrant

请参阅my answer for similar question