[Fixed]-Pycharm (Python IDE) doesn't auto complete Django modules

21👍

I had exactly the same issue and couldn’t find a definitive answer. Just invalidating caches didn’t work for me. The problem lies in the fact that, at some point, __init__.py files got registered as text files and messed up the indexing. I worked out this fix:

  • Preferences > File Types > Text Files.
  • Remove __init__.py from the list of registered patterns. Apply.
  • Wait for your indexes to re-build.
  • (If it’s still not working) File > Invalidate caches & restart.

13👍

GOTO File > Settings > Langauges & Frameworks > Python Template languages

Select Django in the Template language drop-down.

Jetbrains Docs > Python Template Languages

12👍

Nothing here worked for me but Enabling Django support in the settings did:

  1. Settings > Languages & Frameworks > Django
  2. Check of “Enable Django Support”
  3. Fill in the information for your project.

2👍

Trivial solution that worked for me: start a new django project using pycharm project options. Try auto-completing using a django import module. If it works, switch back to your original project and auto-complete should be working fine.

I still don’t understand why this works.

2👍

I worked out this fix:

  1. Go to Preferences > Project:{YourProject} > Python interpreter.
  2. I saw that the field for “Project interpreter” said “2.7…”, but I was coding with python 3.4 and my project was created with python 3.4. Replace the version of python in the “Project interpreter” field with the Python version by means of which you have created your Django project. Apply changes and restart PyCharm.
👤Sergey

0👍

you should just change your project interpreter if it is using anaconda or etc to standard python interpreter which may be located in this path (C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe)

-1👍

File--> setting--> project:your_project_name --> python interperter

change python interpreter

Leave a comment