You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automatically detect a FastAPI application and run it with the correct Debug Configuration.
Steps
Open a FastAPI Project if you already have one or you can also create one following the steps in the FastAPI Tutorial.
Head over to the Run And Debug tab, and click on Show all automatic debug configurations.
A window will open with a list of options, choose Python.
You should now see a list of debug options, and there should be the FastAPI option. Click it and the application should run.
Verification
Make sure that the application has been executed correctly, you can put some breakpoints, to test that the debugging works.
If you repeat the steps and instead of clicking the option, you click the wheel, it should open the launch.json file with the configuration prefilled. Make sure this is correct and can be debugged.
Another form to show the automatic configuration is typing 'debug ' (with a space) in Quick open (⌘P) or by triggering the Debug: Select and Start Debugging command. Test that the Django Debugging recognition works here too.
Notes
FastAPI application detection works by looking for the main.py and app.py files in the root or in a subdirectory just one level lower and looking for them to have the declaration of a fastAPI application app = FastAPI(. So you can try moving the python file and changing the name, and check that the detection still works.
The text was updated successfully, but these errors were encountered:
Refs: #19452
Complexity: 3
Create Issue
Automatically detect a FastAPI application and run it with the correct Debug Configuration.
Steps
Verification
Notes
FastAPI application detection works by looking for the
main.py
andapp.py
files in the root or in a subdirectory just one level lower and looking for them to have the declaration of a fastAPI applicationapp = FastAPI(
. So you can try moving the python file and changing the name, and check that the detection still works.The text was updated successfully, but these errors were encountered: