Logo Microtux

MicroTux

How to resolve ‘Import “django.contrib” error

09-12-2021

How to resolve ‘Import “django.contrib” error. could not be resolved from source Pylance report Missing Module Source’?

https://stackoverflow.com/questions/67586182/how-to-resolve-import-django-contrib-could-not-be-resolved-from-sourcepylance/69494651#69494651

Select the python interpreter in which u have created the virtual environment. Select on the (in Visual Studio Code) bottom left side the python interpreter, o use keys Ctrl+Shift+P. Select in the upcoming menu +Enter interpreter path Point to your virtual environment and select the bin map. Then point to the python interpreter you have installed there. (In my case virtual/bin/python3)
If it is OK you see in the editor: python version. example-> 3.8.10(‘virtual’:venv)