简体   繁体   English

VScode:如何调试python 2.7 cgi脚本?

[英]VScode: How to debug a python 2.7 cgi script?

I have lighttpd web server running on my Windows 7 pc using port 80. My web app calls python cgi scripts. 我的Windows 7 PC上使用端口80运行lighttpd Web服务器。我的Web应用程序调用python cgi脚本。 I am trying to configure VScode to debug these python scripts when I click a button on one of my html pages. 当我单击其中一个html页面上的按钮时,我试图将VScode配置为调试这些python脚本。 For example: 例如:

http://localhost/cgi-bin/instantlight.py?Input=&lightColor=blue

In my launch.json file I have: 在我的launch.json文件中,我有:

{
  "name": "Python: Attach",
  "type": "python",
  "request": "attach",
  "localRoot": "${workspaceFolder}",
  "remoteRoot": "${workspaceFolder}",
  "port": 80,
  "secret": "my_secret",
  "host": "localhost"
}

When I launch the debugger and click a button, my breakpoint is never hit. 当我启动调试器并单击一个按钮时,我的断点永远不会被击中。 After a minute or two I get the error message " Debug adapter process has terminated unexpectedly " 一两分钟后,我收到错误消息“ 调试适配器进程意外终止

What am I missing? 我想念什么?

You don't need to attach to a running process as you're launching the server yourself locally (you only need attach if you're attaching to a server you don't start up yourself). 在本地本地启动服务器时,您无需附加到正在运行的进程(仅当您附加到服务器上而不启动自己时,才需要附加)。 So you can use the eg Python: Current File configuration. 因此,您可以使用例如Python: Current File配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM