How to Debug a Chalice App in Vscode
In this post I will show you how you can create a debug configuration in Visual Studio Code that will allow you to debug a Chalice application locally.
Assuming your virtual environment directory is inside your Chalice project's
directory, add the following configuration to your launch.json
file:
{
"name": "Chalice: Local",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/venv/bin/chalice",
"args": [
"local",
"--no-autoreload",
],
"console": "integratedTerminal",
"justMyCode": true
}
Starting a debug session with that configuration will proceed to invoke the
chalice local
command to start the local dev server.
The cool thing here is how we are able to provide a path to an executable installed through
Pip (in this case chalice
after installing Chalice) and make the Vscode debugger
run it 🌟
In my case my virtual environment directory is called venv
, so you should
change the path according to your configuration.