What's the easiest way to get Flask on Visual Studio Code?
python - How can I get flask to run correctly in VS Code? - Stack Overflow
python - Getting Error: 'No module named flask' in VS Code even when I have installed Flask - Stack Overflow
python - 'No module named flask' in VScode terminal - Stack Overflow
Videos
I tried downloading Flask using the Comand Prompt and Python 3.11 but I couldn't figure it out so I downloaded Anaconda as my lecturer said you can use Flask through this which I have downloaded but I don't understand how to use. I use VSC to do my coding, is there a way I can add Flask to VSC?
I'm a tech newbie so I'm not great at figuring out how to install and use Flask and other modules...
Imp: In Windows 10: Visual studio's integrated terminal is PowerShell. Whereas it was cmd.exe for earlier.
Do:
On Command Prompt:
set FLASK_APP=application.py
On powershell
$env:FLASK_APP = "application.py"
python -m flask run . Try to use this and if this will not work you have to install flask using pip install flask or pip3 install flask in your local .
then use flask run
For more info check: https://pypi.org/project/Flask/
If you have not installed flask using $ pip install then the problem could be that flask is not added as a PATH environment variable.
Try adding flask to your env variables. If this doesn't work then try running $ python -m flask run as a temporary workaround.
This error message can occur if you installed the python3 version of flask but Visual Studio Code tries to run your project with python2.
Make sure to select the correct version of python in the editor. This can be done by running the command Python: Select Interpreter from the Command Palette (Ctrl+Shift+P).
Activate your virtualenv and run
pip3 install -r requirements.txt
to reinstall all packages inside the venv.
For some reason VS Code thought I was missing all my packages the first time I debugged even though the app was running fine locally.