-4

For and if wasn't colored. it's like normal. The html file wasn't considered as python even i used correct syntax

enter image description here

{% if all_album%}
    <ul>
        {% for album in all_album %}
        <li><a href = "/music/{{ album.id }}/">{{ album.album_title }}</a></li>
        {% endfor %}
    </ul>>
{% else %}
    <h3>You don't have any album</h3>
{% endif %}
Ivan
  • 34,531
  • 8
  • 55
  • 100

1 Answers1

0

It's not an "issue with python code conversion in html file in pycharm". You simply have to configure your template's language (jinja) in your project's settings. Take a look at here.

Amin Etesamian
  • 3,363
  • 5
  • 27
  • 50
  • jinja2 doesn't support.on PyCharm Community edition. it will treat as normally.so do u have any other way to do it – NandaKrishnan Jul 27 '17 at 08:45
  • I wanna use Python coding in HTML file. is there any way to do it while jinja2 is not supporting. {% for album in all_album %} it treated as normally now. I want it to treat as python code. Hope you understand – NandaKrishnan Jul 27 '17 at 08:54
  • what do you mean? is your python code treated as text? or is it not simply highlighted? – Amin Etesamian Jul 27 '17 at 11:40
  • I dunno whether it's treated as text or not. but I'm sure that code is not executing. it doesn't show any error. kindly look at the screenshot. it's totally white color. if the python code is accepted in html means then when I type "for" then the color of the text should be changed. but nothing is happening. – NandaKrishnan Jul 27 '17 at 12:00
  • what is the output of the jinja? is an html page exactly with the python code as text or is it pure html? – Amin Etesamian Jul 27 '17 at 12:05
  • Output of the jinja is two links and behind them one line detail Actually jinja is not available in my pycharm I think so. – NandaKrishnan Jul 27 '17 at 12:21
  • dunno how to install jinja in pycharm community edition. Even i have created app without using pycharm. my jinja is not executing. In my html file if i using this {% block content %} {% endblock %}. as it is. it.s showing in browser – NandaKrishnan Jul 27 '17 at 12:22