Flask + Jinja2 = where's autocomplete?
Hi.
I try to work in PyCharm with flask. So, i use jinja2 templates.
And i see strange autocomplete behavior:
1. {{}} set connect
2. {%%} - not auto and after last bracket it adds double one - it looks like {%%}}
3. No autocomplete for functions in delimiters.
3.1. At {{}} there are no auto at all
3.2. for {%%} there are autocomplete in some cases, and some are not.
4. {{ endblock }} delimiters and so on highlighting by spellchecker (it doesn't know it's special construction, not typo).
At pics you can see my project settings.
What's going on? Does IDE sees, it's a jinja-template or not?
PS: code stored at git hub.
https://github.com/Vhodnoylogin/Flask-from-youtube/tree/lesson_9
Please sign in to leave a comment.
Does File | Invalidate Caches / Restart | Invalidate and Restart help?
Try moving the templates folder to the project root and then back to Application.
Has any of it helped?
When i set templates folder to root - 2 and 4 issue were gone.
But it still can't autocomplete in brackets.
What do you mean by "set templates folder to root"? Did you move the templates folder to the project root or did you mark the project root as the Template folder?
Make sure File | Settings | Languages & Frameworks | Flask | Flask integration is enabled.
If u said "move" - i move. So, i moved template folder to project root. See:
And, of course, i use Flask integration from the beginning.
This is quite an old thread now, but I just ran into this problem...
TL;DR
This fixed things for me. I had created the project from the command line, then moved into PyCharm to work on it. This seems to have thrown PyCharm a little. ¯\_(ツ)_/¯
Happy coding!
i faced the same problem, for me autocompletetion was working on other project but not current project, i admit that i moved template folder so many times, then i deleted the project and created a fresh one , this time which any movements, it worked fine