My Flask App server is running but I have three imports that cannot be resolved.
I have tried:
Here is my file structure:
- > .vscode
- > client *(React front end)*
- > data
- > server *(Python/Flask back end)*
- > app
- > venv
- config.py
- README.md
- requirements.txt *(this contains the 3 unresolved, along with several that are resolving)*
- .env
- .flaskenv
- .gitignore
- requirements.txt
Unfortunately none of these things have resolved my imports issue and my routes are still not working. Any ideas/suggestions?
1.Open Command Palette, then select the Python: Select Interpreter command. From the list, select the virtual environment in your project folder that starts with .env
.
2.Run Terminal: Create New Integrated Terminal (Ctrl+Shift+`)) from the Command Palette, which creates a terminal and automatically activates the virtual environment by running its activation script.
3.Install sqlalchemy
and mongoengine
with command pip install
. Once installing them successfully, there will intellisense when you import them and no warnings shown.
Besides, the folder .vscode
is to store Workspace settings as well as debugging and task configurations.
I specified a path to the python interpreter I'm using within the settings.json file contained in the project repo's .vscode folder.
"python.pythonPath": "path-to-interpreter.python.exe"
Thanks to the following resource! https://dev.to/climentea/how-to-solve-pylance-missing-imports-in-vscode-359b
If you are using a virtual environment, and even after trying pip installing all the necessary libraries, you have to select the python interpreter that exists in the virtual environment folder.
These steps allow you to select the right python interpreter associated with the project's virtual environment.