A bottle project of mine uses Jinja2. PyCharm does not automatically recognize it and shows such lines as errors. Is there a way to make Jinja2 work?
5 Answers
In the pro edition, these template languages:
- Jinja2
- Django
- Mako
are supported. You can configure the template language in the project's settings:
The community edition may lack certain template languages.

- 60,309
- 67
- 216
- 347
-
1I got "Expected }}" warning for every function calls such as {{ func('hello word') }}. How can I fix it? – Kenji Noguchi Nov 26 '13 at 21:34
-
You need to apply the change, otherwise it will go back to assuming django formatting. – Spooner Jun 11 '15 at 11:58
-
2"Out of the box" is not correct for PyCharm Community edition -- see below. (I tried to edit this information into the answer, but it got rejected 3-2.) – Noumenon Jun 27 '16 at 01:12
-
2@Noumenon I've added the information to my own answer, as I think that clarifies it a bit more. The reject was, in principle, fine by stackoverflow standard (changes intent of the author) and edits are not necessarily there to correct false answers, for that one should either downvote the answer and create your own and write a comment. Yours was an edge-case as I do think it would have improved my answer significantly. – k0pernikus Jun 27 '16 at 10:09
-
4Your comment would have made a great, educational rejection message for my edit. "Doesn't improve the answer even a little" tends to get my hackles up. Thank you. – Noumenon Jun 27 '16 at 12:13
I think it's worth to mention that PyCharm Community edition does not support Jinja2, Mako and Django. It's available only in PyCharm Professional.
See comparison of the two.

- 5,579
- 3
- 25
- 29
-
2Also worth to mention that (even as of PyCharm 3.1) Debugging Jinja and Mako templates is not supported [even in pro edition]. https://www.jetbrains.com/pycharm/webhelp/debugging-django-templates.html – okigan Mar 30 '14 at 20:17
-
4This is very worth mentioning. I just spent 5 minutes looking through the project settings (based on the first answer) before I read this answer. – Chris Mueller Jun 17 '16 at 18:06
Yes pro edition from pycharm does support Jinja2 to enable it go here
From File open Settings and search for python template under Languages & Frameworks Select Python Template Languages from there Click HTML And Select Jinja2 as Template Language.
please see the image for better understanding.

- 4,581
- 2
- 19
- 32
-
1I am a bit confused as to where the difference is from my answer: http://stackoverflow.com/questions/15750551/does-pycharm-support-jinja2/15750552#15750552 – k0pernikus Feb 01 '17 at 16:20
-
11
-
3
If you are using .jinja
extension instead of .jinja2
, it won't work, templates are not highlighted.
You have to add the file extension to the filetypes section.
- Preferences > Editor > General > Filetypes
- Scroll to Jinja 2 Template
- Register new pattern by clicking +, add
*.jinja

- 2,399
- 3
- 25
- 41

- 2,659
- 3
- 34
- 41
-
I use the `jinja2` extension but this doesn't seem to play along with the template settings that only allow to pick html. Should I use html or jinja2 as extensions in order for the preview to work? – t3chb0t Nov 16 '21 at 09:52
In community edition, the python template option is not available, so you can simply click on python packages next to the terminal present on the bottom. This will also add Jinja2