Unresolved import references of Django modules
Hello
Out of the blue in all my Django projects( current, old, new) all Django modules imports, Django settings dot notations are marked with red lines(wrong imports). I specially created new Django project to chek it, and output is like this:
for Django imports
for built in python modules:
What i did:
1) Tried to mark all folders as source folders
2)Invalidate cache an restart
3) Used pip and pipenv separatelly
4)Created project on different disc drives
5) remove .virtualennv and pycharm-projects
6) Remove all trash from PATH
7)Re installed python completelly
8)Create Django project from powershell mannually instead of create it via PyCharm
Nothing has helped to solve it.
In general these import issues dont affect Django work, that is all imports in fact work , but PyCharm doesnt see import path for some reason.
my os -windows 10
PyCharm version 2019.2
python 3.8.2 32 bit
Pycharm sees Django in installed modeles
Project structure is like this:
Please sign in to leave a comment.
Where are you navigated if you go to declaration on, let's say, django.urls ?
Andrey, thank you for the answer.
I re-installed PyCharm and it helped.
As far as i remember if you ctrl+B django.urls it would either navigate you to __init__ file of this module or to source code itself, but source code was written as text without coloring ( just plain white text).
I'm using (also) a Mac M1 and I cannot seem to make it work properly there!
Django is installed in my local .venv . If I start typing django a popup will appear with all suggested packages (eg. django as well as other django_* that I have in the site-packages) however if I finish typing "django" and option+click on it it will prompt for "install and import package 'django'".
If I accept the prompt it will import with "import django as django" ???
In any case no other package under django will be detected .
Help please
G Bronzini Could you please show a screenshot of the whole IDE window capturing your project structure and the issue?
Had to:
- remove the virtualenv from the IDE configurations (settings -> Python Interpreter -> Show all and remove it)
- remove .idea folder
- remove .venv (local venv)
- close Pycharm
- recreate the venv
- restart Pycharm and set back everything
and now it works.... But as this is not the first time I had to do this I will update this thread with the requested snapshots.
NB: The "repair IDE" did not otherwise solved the issue.