In the pro edition, these template languages:
Jinja2
Django
Mako
are supported. You can configure the template language in the project's settings:
https://i.stack.imgur.com/TS8P4.png
The community edition may lack certain template languages.
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.
https://i.stack.imgur.com/7X7lU.png
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.
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 > General > Filetypes
Scroll to Jinja 2 Template
Register new pattern by clicking +, add *.jinja
https://i.stack.imgur.com/HyYEX.png
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?
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
Success story sharing