Test: Implement automatic configuration for Flask
See original GitHub issueRefs: https://github.com/microsoft/vscode-python/issues/19451
- macOS @sbatten
- linux @karthiknadig
- windows @amunger
Complexity: 3
Automatically detect a Flask application and run it with the correct Debug Configuration.
Steps
-
Open a Flask Project if you already have one or you can also create one following the steps in the Flask 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 Flask 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
Flask’s application detection works by looking for the wsgi.py, app.py and init.py files in the root or in a subdirectory just one level lower and looking for them to have the declaration of a flask application app = Flask(
. So you can try moving the python file and changing the name, and check that the detection still works.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
@paulacamargo25 I tested this on Ubuntu, seems to be working for me:
This is my layout:
Hi @alexr00 what happens when you click on the wheel?