简体   繁体   中英

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. I am trying to configure VScode to debug these python scripts when I click a button on one of my html pages. For example:

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

In my launch.json file I have:

{
  "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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