1

I am a beginner in python, django coding. I just receive a folder that consist of a web made out of django. After i recieve it, I use powershell and go to that folder :

pipenv shell 
pipenv install Django==3.2.5 

When i open the codes in visual studio code, I got problems: enter image description here

How do i solve this issue?

PS: Disable Pylance removes the problem. But will this affect my development of the website? Can someone kindly explain to me?

Calvin Lin
  • 59
  • 1
  • 1
  • 7
  • Kindly check this solution may be it help https://stackoverflow.com/questions/65786221/import-flask-could-not-be-resolved-from-source-pylance-reportmissingmodulesou – Ashish Nautiyal Jul 27 '21 at 04:49
  • I understand it is about django packages but shouldnt the command above install all the package from django? I did it in a guided example and I have no such issues though – Calvin Lin Jul 27 '21 at 06:09

4 Answers4

1

You should make sure you have selected the right python interpreter which you have installed the packages you want to import.

Such as this python interpreter created by the pipenv:

enter image description here

Or you can reinstall the packages under the python interpreter which you have selected in the VSCode.

You can refer to this page for more information about the environment in VSCode.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
1

I solved this by simply clicking . (ctrl + ,) and then searching venv . then just click items and add the directory to were your virtual env is installed.

That pretty much cleared up all these errors for me and also I can reuse my VirtualVenv for all my django related projects

0

Sometimes just quitting and reopneing VS Code helps. I know it's weird but it works for me for these errors sometimes so give it a try.

Saitama
  • 13
  • 3
0

You should make sure you have selected the right python interpreter which you have installed the packages you want to import because using the wrong interpreter might bring up such errors

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 10 '22 at 09:57