在开发过程中,我经常会遇到多个实时会话.PyCharm为我提供了关闭所有调试器选项卡(或所有其他选项卡)的选项,但是对于每个实时会话,它会打开此对话框,我必须单击每个选项卡以断开连接.有没有办法让PyCharm自动断开连接并终止所有进程?
也许这个问题的最佳答案是不要首先开始所有这些会议.如果您真正想要做的是在启动调试器时终止现有会话,请在"运行/调试配置"对话框中设置"仅单实例"选项.
然后每次单击调试图标(或Shift + F9)时,它将停止当前会话并启动一个新会话.在我弄清楚这是做什么之前,即使我不再对它们感兴趣,我最终还会继续运行一些会话.
PyCharm帮助说明了以下内容,但根据我的经验,选中此选项后,重新启动调试器只会终止当前实例并启动一个新实例.当您不希望运行一堆旧实例时,这很有用,但在构建Django应用程序时并不希望多个实例同时运行时,这很重要.
If this check box is selected, this run/debug configuration cannot be launched more than once. Every time a new run/debug configuration is launched, PyCharm checks the presence of the other instances of the same run/debug configuration, and displays a confirmation dialog box. If you click OK in the confirmation dialog box, the first instance of the runner will be stopped, and the next one will take its place. This make sense, when usage of certain resources can cause conflicts, or when launching two run/debug configurations of the same type consumes too much of the CPU and memory resources. If this check box is not selected, it is possible to launch as many instances of the runner as required. So doing, each runner will start in its own tab of the Run tool window.