I'm trying to understand how to configure Pylance to make it work correctly in my Django project.
Below is one of many examples where Pylance is not able to find what I'm looking for. Here, I obviously need models
from django.db
. But there are only theses 6 suggestions below...
Here is what I know or tried:
"python.analysis.extraPaths": ["${workspaceFolder}/dj_proj/dj_apps"]
-> which works to prevent missing imports. I have no false warnings about missing imports, just the inability to see the right suggestions in intellisense.__pycache__
and .pyc
files -> no effect__init__.py
pretty much everywheresys.path
(PYTHONPATH) looks like this (where dj_proj
is my django project and dj_apps
my apps folder):['/workspace/dj_proj/dj_apps',
'/workspace/dj_proj',
'/usr/local/lib/python310.zip',
'/usr/local/lib/python3.10',
'/usr/local/lib/python3.10/lib-dynload',
'',
'/usr/local/lib/python3.10/site-packages']
I'm suspecting this PYTHONPATH variable to be messy or not sorted the right way, but I'm not sure.
Any idea on what could be wrong? Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.