Importing from "django.(any module)" gives me this warning : could not be resolved from source

Viewed 2936

I have just created a Django project in a virtual environment and I'm getting this error or warning I'm not quite sure :

(module) django Import "django.contrib" could not be resolved from source Pylance(reportMissingModuleSource)

in every line that has import from django .

I have searched for this problem and I have tried these so far :

  1. editing Settings.JSON file in VScode by adding :

    "python.pythonPath": "C:/Users/abdur/dev/cfehome/django_project/Scripts/python.exe",
    

    Which is the python.exe location in my virtual environment

  2. I have selected Python Interpreter to the one that is inside the virtual environment like this picture : enter image description here

    I have tried the other choice too but didn't work as well .

However when I run python manage.py runserver it works without giving me any errors but I'm trying to understand why I'm getting these warnings .

1 Answers

I assume you've selected another interpreter from the one you're using for your Django. Try to follow these steps, I've described in similar question. Whish you good luck!

Related