question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test: Implement automatic configuration for Flask

See original GitHub issue

Refs: https://github.com/microsoft/vscode-python/issues/19451

Complexity: 3

Create Issue


Automatically detect a Flask application and run it with the correct Debug Configuration.

Steps

  1. Open a Flask Project if you already have one or you can also create one following the steps in the Flask Tutorial.

  2. Head over to the Run And Debug tab, and click on Show all automatic debug configurations. Screen Shot 2022-07-25 at 2 09 44 PM

  3. A window will open with a list of options, choose Python.

  4. You should now see a list of debug options, and there should be the Flask option. Click it and the application should run.

Verification

  1. Make sure that the application has been executed correctly, you can put some breakpoints, to test that the debugging works.
  2. 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.
  3. 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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Jul 29, 2022

@paulacamargo25 I tested this on Ubuntu, seems to be working for me: image

This is my layout: image

0reactions
paulacamargo25commented, Jul 28, 2022

Hi @alexr00 what happens when you click on the wheel?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Flask Applications — Flask Documentation (1.1.x)
Flask provides test_cli_runner() to create a FlaskCliRunner that passes the Flask app to the CLI automatically. Use its invoke() method to call commands...
Read more >
Testing a Flask framework with Pytest - CircleCI
In this project tutorial, we will use a simple book-retrieval API built with Flask. We will use the API to show how we...
Read more >
Testing Flask Applications with Pytest - TestDriven.io
cfg') # Create a test client using the Flask application configured for testing with flask_app.test_client() as testing_client: # Establish an ...
Read more >
Automated testing in Flask - python - Stack Overflow
Because client is a pytest fixture, you need to include it as anargument to your test, so this should solve your current issue...
Read more >
Guide to Python Flask Unit Testing - Code The Change Stanford
We will use a pytest feature called “fixtures” to turn our web app into a Python object we can run tests against. Copy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found