34

I've just installed PyCharm, and have opened an existing project with multiple apps. When I open django templates, they are highlighted as if plain HTML, i.e. {% block %} elements and {{variable}} references are not treated specially.

Is there any way I can force it to use the django template syntax highlighter for these files? Or am I doing something wrong?

The project is configured as a django project.

2 Answers 2

64

File » Settings » Template language, do you have Template language setting set to django?

Sign up to request clarification or add additional context in comments.

6 Comments

Brilliant, I knew it would be something simple. Thanks very much.
As of PyCharm 3.x, it's in File » Settings » Python Template Languages. I used this same setting to activate syntax highlight in .js files that I'm using as templates.
Using the green + icon, you can add filetypes too. This helped me with Django templates used for plain-text emails.
In OS X, PyCharm >> Preferences >> Languages & Frameworks >> Python Template Languages
This feature does not exist in the community edition. stackoverflow.com/questions/41079540/…
|
0

Updating because this came up when I googled for an answer and we're several revisions beyond PyCharm 3.x.

In PyCharm 2024.1 open Settings. It's under Languages & Frameworks >> Template Language. Select Django from the Template languages drop down.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.