PyCharm autocomplete stops working in Django project

Hello,

Sorry but I ran out of ideas. I'm struggling with strange issue with code autocomplete. It stops working after IDE restart.

When I start Django project from scratch (File --> New Project --> Django) and I create new app, setup all views, templates etc, everything works fine. For example, in my views.py file i have:

def index(request):
content = {'some_dict': 'value'}
return render(request, 'test/index.html', content)

Then I go to template index.html file, put Jinja2 tags {{ }} and start type 's', PyCharm suggests autocomplete 'some_dict', which is correct, right?

Ok. But when I restart IDE, re-open project and try to do same thing, PyCharm can't suggest what to put in those tags. Actually It suggests anything.

Did someone experienced something like this before? I'd be very grateful for your help!

 

My PyCharm Pro version is 2020.03, running on MacOS BigSur(11.0.1).

 

5 comments
Comment actions Permalink

Ok, I found a solution.

Apparently after re-opening IDE, PyCharm didn't apply settings.py file under Settings --> Languages & Frameworks --> Django. I edited "Settings" attribute as below:

And voila! PyCharm is autocompleting my tags again!

2
Comment actions Permalink

Hello, 

 

I am very sorry you have faced the bug https://youtrack.jetbrains.com/issue/PY-45753 , please feel free to vote. 

0
Comment actions Permalink

Things don't work on my side, even after reselecting "setting.py" settings and clicking "invalidate cache / restart" menu.

And both python and html autocomplete don't work.

PyCharm Pro: 2020.3; OS: macOS 11.1; Intel.

I don't know exactly what I did before this happens, maybe a "create-react-app frontend" in the Django app root folder?

0
Comment actions Permalink

Sam Tang

Please update to the latest version (2020.3.2 at the moment) and try again.
If the problem remains, report it to https://youtrack.jetbrains.com/issues/PY and we'll investigate.

0
Comment actions Permalink

I have the same problem...

But I don't have single settings.py file, i have settings module instead...

What is the solution for this?

0

Please sign in to leave a comment.