Does PyCharm support Jinja2?

后端 未结 4 1638
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 07:50

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?

相关标签:
4条回答
  • 2020-12-13 08:34

    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.

    0 讨论(0)
  • 2020-12-13 08:44

    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.

    0 讨论(0)
  • 2020-12-13 08:45

    In the pro edition, these template languages:

    • Jinja2
    • Django
    • Mako

    are supported. You can configure the template language in the project's settings:

    In Python Template Settings the template langauge is set to Jinja2

    The community edition may lack certain template languages.

    0 讨论(0)
  • 2020-12-13 08:45

    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

    0 讨论(0)
提交回复
热议问题