Shown below is the code from my launch.json file for my Flask application. I have various environment variables defined in the "env": {}
portion. However, when I run my Flask application from the run.py script, it doesn't seem to recognize the variables. Although the "FLASK_DEBUG"
is set to "1"
, the application still runs on **Debug mode: off**
.
Does anyone know why?
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "run.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "1",
"EMAIL_USER": "farmgo.project.21@gmail.com",
"EMAIL_PASS": "password",
},
"args": [
"run",
//"--no-debugger"
],
"jinja": true,
}
],
}
If I set:
if __name__ == '__main__':
app.run(debug=True)
then the app does run in Debug mode. However, I still cannot get the other environment variables:
>>> import os
>>> print(os.environ.get('FLASK_DEBUG'))
None