I'm new to Python Flask development and VS Code. I've been trying to create an app by referring the below tutorials.
https://code.visualstudio.com/docs/python/tutorial-flask
https://github.com/Microsoft/python-sample-vscode-flask-tutorial\
https://code.visualstudio.com/docs/python/debugging
Repo for reference: https://github.com/iamshivprasad/analytics
Cloned folder structure is:
- Development
- .vscode
- launch.json
- analyticspyengine
- analytics_modules
- controllers
- datainterfaces
- utils
- __init__.py
- analyticsservices.py
- webapp.py
.
.
.
I am able to launch the program successfully with below settings in launch.json.
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "analyticspyengine.webapp",
"FLASK_DEBUG": true,
"FLASK_ENV": "development"
},
"args": [
"run"
],
"jinja": true
}
Content of webapp.py
#!/usr/bin/python3
import sys
from . import app
from . import analyticsservices
Content of analyticspyengine/__init__.py
#!/usr/bin/python3
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
from flask import Flask
app = Flask(__name__)
I'm facing the following problems. Completely helpless and frustrated!!!
1) Execution is not hitting any breakpoints
2) After launching the app with the above settings, I'm not able to stop the service. i.e, Even after stopping the debugger, the app seems to be running. I can see the requests are being served through terminal output and Postman. The process seems to be alive until VS Code is closed.
Could someone shed some light?