Pycharm not recognizing django template tags

I had to reinstall my mac osx and on installed a fresh copy of pycharm. I cloned a git django project and I loaded the project using open directory and it didn't recognize it. Then I ticked enable django support and everything works, I can run and stuff, except that the IDE is not recognizing my template tags such as {% for ... %} and it is not creating the closing brackets automatically. Further, the syntax highlight for the template tags are not working as well.

Any solutions?


Please make sure that the Django template format is selected under Settings | Template Languages.


I'm having the same problem and my Template Language is set to Django.



Could you please attach a screenshot demonstrating the problem?


no template highlighting.tiff

Attached screen shot show template settings and template file open in editor. Highlighting not being applied.

no template highlighting.tiff

I'm sure it's got something to do with the .idea directory.

I tried everything, even opening my other django project that has everything working and setting the exact same settings. It still doesn't work. So in the end I deleted the default .idea directory and copied over the .idea from the django project that was working. I opened up the project, a few errors popped up and after that everything was working fine.


Please map the .djt extension to the HTML file type in Settings | FIle Types.


Problem solved. Thanks!


I have the exact same problem. My Template Language is set to Django and I've mapped the *.djt extensions to the HTML file type in Settings | File Types. Still, no template tags are being highlighted. What's more, line comment or code formatting are not working in my HTML files. 



Please provide screenshots to demonstrate the issue and **idea.log** file, which you can find using **Help > Show log in...** action.

Ensure that you have HTML Tools plugin enabled.


Hi i have the same problem, i've checked that html plugin is enabled and in the settings there is an extension *.djt, but the problem isn't solved. I attached a screenshot.


Template tags are not recognized, please notice also the changed icon of the .html file. I've done all of the above, nothing seemed to be the case.


Do you have Vue.js plugin installed?
There is a known issue with it


If Vue.js plugin installed

Add Vue.js template in Settings | Languages & Frameworks | Template Languages | Template File Types it's fix Django template support


axel thanks a lot! it was bugging me for a long time


axel you saved my day and my year !


Custom Template Tags and Inheritage| Loops and Ifs/ Else


My issue was the same, just I wasn't careful when I was setting up the in templates the DIR:[ ] has to show on 'templates' (folder inside the app), or the path of it 'absolute path', as well as I haven't pay the attention on context rendering and hmtl tags inside of base.html file.

So finally I got the {{list}} and {{my_num}} working by configuring it like this:

def News(request):

context = {
"list":["Python", "Java", "C++", "Kotlin","Ruby"],
"my_num": 500



{% extends 'base.html' %}

{% block title %} News {% endblock %}
{% block body %}

<h1>This is our latest news page</h1>

<p>This is our latest news description</p>


{% for lang in list %}

<li>{{ lang }}</li>

{% endfor %}

{% if my_num == 50 %}

<h1> Condition is true</h1>

{% else %}
<h1> Condition is false</h1>

{% endif %}

{% endblock %}



So basic example that PRACTICE and PAYING ATTENTION ON THE SMALLEST DETAILS CAN occur in issue while rendering your pages/templates and template custom tags/tags.


Thank you all, and PyCharm Community and Intellij-support/ @Andrey Leisler Axel, Nicolas Devaux Sergey Karpov and zentenk1(for pulling out this 'charming' topic) it's been a 100... :)

One Feature Request (as I worked as DevOps in one huge reputable enterprise company):


  • Please even in the community edition, you could at least make it automatically {% to show the closure " %}" so it would be much easier to program and not waist seconds and stuff on {% some text %}  as it in fast-typing it can easily occur that it can end up like this %{some text%} or even with {{ }} context tags...

i could not find the template languages settings 



It looks like you are using PyCharm Community while Django support is available only in PyCharm Professional.


I had the same issue and found that I needed to update the settings:

In Pycharm choose File -> Languages & Frameworks -> Django -> Settings:

Once I pointed it to the projects app/ file it started to work again.


Please sign in to leave a comment.