Debugging FastAPI apps with VSCode #2556
br3ndonland
started this conversation in
Show and tell
Replies: 1 comment
-
Thanks, that was very helpful and worked like a charm! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@Kludex added a FastAPI debugger configuration to VSCode (microsoft/vscode-python#14247, microsoft/vscode-python#14606). Thank you @Kludex! 🚀 👏
Let's share our tips and troubleshooting here.
If you haven't tried it before, the VSCode debugger is a great way to run your FastAPI app for local development. To use the debugger config:
Update your vscode-python extension to version 2020.12.0 or later, and reload VSCode.
Navigate to the debugger pane, click "create a launch.json file," and select "FastAPI."
Set breakpoints by clicking in the sidebar. Try setting a breakpoint in one of your FastAPI routes, then send a request to that route. VSCode will pause on your debugger breakpoint:
Feel free to clone the project in the screenshot if you would like to try it out. You will need to install Poetry, then run
poetry install -E fastapi
. The theme in the screenshot is Dracula Pro, the font is Dank Mono, the shell is Zsh with pure prompt, the HTTP client is HTTPie, and the VSCode settings are available here.Beta Was this translation helpful? Give feedback.
All reactions