As I understand it, Mu sets some environment variables when running in Flask mode. One of those variables is FLASK_ENV, which is deprecated since Flask 2.2.0 so a deprecation warning is shown:
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
What's worse, if I remove that environment variable and add FLASK_DEBUG, the FLASK_ENV is added automatically added by Mu.
I added FLASK_DEBUG, run the app, and checked the current environment variables:
If the team agrees, I'd be happy to help with a PR that switches from using FLASK_ENV to using FLASK_DEBUG.
What were you trying to do?
Run Mu in Flask mode
What steps did you take to trigger the issue?
Run Mu in Flask mode
What did you expect to happen?
No deprecation warnings displayed
What actually happened?
As I understand it, Mu sets some environment variables when running in Flask mode. One of those variables is
FLASK_ENV
, which is deprecated since Flask 2.2.0 so a deprecation warning is shown:What's worse, if I remove that environment variable and add
FLASK_DEBUG
, theFLASK_ENV
is added automatically added by Mu.I added
FLASK_DEBUG
, run the app, and checked the current environment variables:If the team agrees, I'd be happy to help with a PR that switches from using
FLASK_ENV
to usingFLASK_DEBUG
.Operating System Version
macOS 12.6.3
Mu Version
1.2.0
Other Info
No response
Editor Log
Logs
``` 2023-02-23 13:35:15,931 - root:283(run) INFO: ----------------- Starting Mu 1.2.0 2023-02-23 13:35:15,932 - root:284(run) INFO: uname_result(system='Darwin', node='Morbo.local', release='21.6.0', version='Darwin Kernel Version 21.6.0: Mon Dec 19 20:43:09 PST 2022; root:xnu-8020.240.18~2/RELEASE_ARM64_T6000', machine='x86_64', processor='i386') 2023-02-23 13:35:15,944 - root:285(run) INFO: Platform: macOS-12.6.3-x86_64-i386-64bit 2023-02-23 13:35:15,944 - root:286(run) INFO: Python path: ['/Applications/Mu Editor.app/Contents/Resources/Python/lib/python38.zip', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/lib-dynload', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages'] 2023-02-23 13:35:15,944 - root:287(run) INFO: Language code: en_US 2023-02-23 13:35:15,945 - mu.settings:220(load) WARNING: No settings file found at /Users/pawelad/Library/Application Support/mu/settings.json; skipping 2023-02-23 13:35:16,283 - mu.virtual_environment:619(ensure_and_create) INFO: Added log handler. 2023-02-23 13:35:16,284 - mu.virtual_environment:630(ensure_and_create) DEBUG: Checking virtual environment; attempt #1. 2023-02-23 13:35:16,396 - mu.virtual_environment:719(ensure_path) INFO: Virtual Environment found at: /Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416 2023-02-23 13:35:16,402 - mu.virtual_environment:732(ensure_interpreter) INFO: Interpreter found at: /Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python 2023-02-23 13:35:16,403 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python', '-c', 'import sys; print("%s%s" % sys.version_info[:2])') with kwargs {'shell': False} 2023-02-23 13:35:16,433 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: 38 2023-02-23 13:35:16,433 - mu.virtual_environment:786(ensure_interpreter_version) INFO: Both interpreters at version 38 2023-02-23 13:35:16,435 - mu.virtual_environment:815(ensure_pip) INFO: Pip found at: /Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/pip 2023-02-23 13:35:16,436 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: pgzero 2023-02-23 13:35:16,436 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python', '-c', 'import pgzero') with kwargs {'shell': False} 2023-02-23 13:35:16,464 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received. 2023-02-23 13:35:16,464 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: flask 2023-02-23 13:35:16,464 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python', '-c', 'import flask') with kwargs {'shell': False} 2023-02-23 13:35:16,637 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received. 2023-02-23 13:35:16,638 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipykernel 2023-02-23 13:35:16,638 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python', '-c', 'import ipykernel') with kwargs {'shell': False} 2023-02-23 13:35:17,179 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received. 2023-02-23 13:35:17,180 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipython_genutils 2023-02-23 13:35:17,180 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416/bin/python', '-c', 'import ipython_genutils') with kwargs {'shell': False} 2023-02-23 13:35:17,204 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received. 2023-02-23 13:35:17,205 - mu.virtual_environment:662(ensure_and_create) INFO: Valid virtual environment found at /Users/pawelad/Library/Application Support/mu/mu_venv-38-20230112-112416 2023-02-23 13:35:17,205 - mu.settings:169(save) DEBUG: Saving to /Users/pawelad/Library/Application Support/mu/venv.json 2023-02-23 13:35:17,232 - mu.logic:777(__init__) INFO: Setting up editor. 2023-02-23 13:35:17,233 - mu.logic:801(__init__) INFO: Log directory: /Users/pawelad/Library/Logs/mu 2023-02-23 13:35:17,233 - mu.logic:802(__init__) INFO: Data directory: /Users/pawelad/Library/Application Support/mu 2023-02-23 13:35:17,233 - mu.logic:816(setup) INFO: Available modes: python, snek, circuitpython, microbit, esp, web, pyboard, debugger, pygamezero, lego, pico 2023-02-23 13:35:17,233 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/pawelad/mu_code from settings file 2023-02-23 13:35:17,290 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/pawelad/mu_code from settings file 2023-02-23 13:35:17,290 - mu.logic:1583(change_mode) INFO: Workspace directory: /Users/pawelad/mu_code 2023-02-23 13:35:17,290 - mu.logic:890(restore_session) DEBUG:Hello {{ name }}, how are you?
{% endblock %} 2023-02-23 13:35:17,397 - mu.logic:1015(_load) INFO: Loading script from: /Users/pawelad/mu_code/templates/base.html 2023-02-23 13:35:17,397 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8 2023-02-23 13:35:17,397 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8 2023-02-23 13:35:17,397 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n' 2023-02-23 13:35:17,397 - mu.logic:1114(_load) DEBUG:Hello {{ name }}, how are you?
Hello {{ name }}, how are you?
{% endblock %} 2023-02-23 13:42:50,345 - mu.logic:1015(_load) INFO: Loading script from: /Users/pawelad/mu_code/templates/base.html 2023-02-23 13:42:50,346 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8 2023-02-23 13:42:50,346 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8 2023-02-23 13:42:50,346 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n' 2023-02-23 13:42:50,346 - mu.logic:1114(_load) DEBUG:Hello {{ name }}, how are you?
Hello {{ name }}, how are you?
{% endblock %} 2023-02-23 13:47:04,182 - mu.logic:1015(_load) INFO: Loading script from: /Users/pawelad/mu_code/templates/base.html 2023-02-23 13:47:04,182 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8 2023-02-23 13:47:04,182 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8 2023-02-23 13:47:04,182 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n' 2023-02-23 13:47:04,182 - mu.logic:1114(_load) DEBUG:Hello {{ name }}, how are you?