Black Lives Matter. Please consider donating to Black Girls Code today.

VC Issue?: No module named problem though works without (debug=True)

In my first learning Dash project folder I have various scripts from the tutorials. I went back to deepen my understanding of callbacks. It worked in my Visual Code project last time I used it. Now it doesn’t. I even restarted my PC. When I try to run a script it just ends back at the (.venv) prompt. It seems to start the Flask server but exits right after.

What’s interesting is if i make it app.run_server() instead of app.run_server(debug=True) it runs fine. I hope not to spend hours learning the ins and outs of VC. I hope someone knows the quick fix!

My work flow when developing flask apps, it to use flask run however, I just started a new project and flask run isn’t working. (it works on other projects I have)

set FLASK_APP=budgeter.app
set FLASK_ENV=development

(.venv) D:\python\flask\flask-budget>flask run
 * Serving Flask app "budgeter.app" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Restarting with stat
d:\python\flask\flask-budget\.venv\scripts\python.exe: Error while finding module specification for 'D:\\python\\flask\\flask-budget\\.venv\\Scripts\\flask' (ModuleNotFoundError: No module named 'D:\\python\\flask\\flask-budget\\')

However, I can run,

(.venv) D:\python\flask\flask-budget>python -m budgeter.app
 * Serving Flask app "app" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 149-432-946
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

This is really bugging me and I don’t know what I’ve done wrong.