Flask, starts with flask-script. How should vscode turn on debug mode?

I have also checked some tutorials on the Internet. At present, I can start in vscode, but I just can"t enter debug mode. I hope someone can explain my following questions

.
  • launch.json configuration code is as follows
{
    "name": "Python: Flask (0.11.x or later)",
    "type": "python",
    "request": "launch",
    "module": "flask",
    "env": {
        "FLASK_APP": "manage.py"
    },
    "args": [
        "run"
    ]
},
  • since flask-script is used to start, the command to start is python manage.py runserver
  • if I use the command line tool pyhton manage.py runserver display to enter debug mode
  • remarks, my core startup file name is manage.py, not app.py
  • at present, the above configuration vscode can start flask, but cannot enter debug mode. Here is the prompt to start
* Serving Flask app "manage.py"
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

-split line-

  • the parameter in the configuration file is run. Runserver tells you that there is no such command. If you use manage.run, it should be runserver, that feels strange
  • .
  • I tried manager.add_command ("runserver", Server (use_debugger=True), but it didn"t work. In fact, I have set DEBUG to True in config
  • I hope someone with experience can give me some advice and tell me the principle of flask startup and debugging here in vscode. I feel that vscode startup must be different from command line startup. I don"t know what vscode does here?
Mar.24,2021

try configuring launch.json like this.

{
    "name": "Python: Flask (0.11.x or later)",
    "type": "python",
    "request": "launch",
    "module": "flask",
    "env": {
        "FLASK_APP": "manage.py"
    },
    "args": [
        "runserver --host 0.0.0.0 --port 5000"
    ]
},
Menu