【问题标题】:How to do cProfile in django production server如何在 django 生产服务器中执行 cProfile
【发布时间】:2012-08-03 09:13:18
【问题描述】:

我想在生产环境中监控我在 Django 应用程序中的视图。所以,我遇到了我在本地环境中测试的解决方案 script。工作正常!!。

当我投入生产环境时,我遇到了 Unhandled Exception due to debug=True的问题。我也在本地环境中使用了 debug=True(由 django 服务器提供静态)。

是否可以使用上面的链接middleware访问对应django视图的hotshot?

你能帮我做一下 django 生产服务器链接中提到的 hotshot 或 cProfile 吗?

【问题讨论】:

    标签: python django cprofile


    【解决方案1】:

    您发布的中间件应该可以在生产中正常工作 - 注意顶部评论中的说明:

    如果您以超级用户身份登录,或者当 settings.DEBUG 为 True 时,它​​始终处于活动状态。

    因此,请确保您以超级用户身份登录。

    也就是说,我个人对这些 cProfile 中间件解决方案的运气并不好。自己运行 cProfile 非常容易(使用cprofile.run()),你可以view the output using KCacheGrind

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-11
      • 2014-05-22
      • 2011-09-29
      • 1970-01-01
      • 2012-05-18
      • 1970-01-01
      • 2012-05-29
      • 2013-05-01
      相关资源
      最近更新 更多