Visual Studio Code and debugging

615 views
Skip to first unread message

Andrea Fae'

unread,
Mar 22, 2017, 7:34:17 AM3/22/17
to web2py-users
I tried to use Visual Studio Code like IDE for debugging web2py programs.

In the launch.json I inserted this:
{
            "name": "Web2py",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config.python.pythonPath}",
            "program": "${workspaceRoot}/../../web2py.py",
            "args": [
            ], 
            "cwd": "${workspaceRoot}",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput"
            ]
        }


I installed Python 0.6.0 extension from Don Jayamanne.
But if I fix some breakpoints the program doesn't stop...why?
I'd like to use Visual Studio Code to debug my web2py programs...

Moreover, anyone knows if there is a free easy IDE to use as debugger for web2py? Can I have any information?

Thank you

Ty oc

unread,
Mar 26, 2017, 12:42:46 AM3/26/17
to web2py-users
You have 2 options, first is to optne the full web2py with applications directory and open web2py script and hit run (with internal console, external and so on should work)

Or setup remote debugging https://donjayamanne.github.io/pythonVSCodeDocs/docs/debugging_remote-debugging/

basically you need to install python -m pip install  ptvsd and then in for example db.py put the two lines

import ptvsd
ptvsd.enable_attach("my_secret", address = ('0.0.0.0', 3000))


and that will be it... Im just testing now, but I guess any of the two should work
Reply all
Reply to author
Forward
0 new messages