I am using IntelliJ IDEA 13 Ultimate edition with its Python plugin. I opened an existing folder containing a Django project (which I had created using Vim) as an IntelliJ project and enabled the Django facet manually on it. However, my HTML files are still being treated as plain HTML files - Django template tags and syntax aren't recognized. I recall that Django templates were automagically recognized by IntelliJ in an earlier project, but can't reproduce it now.
How can I get IntelliJ to recognize my template files as Django templates, please?
IntelliJ IDEA supports the latest Django versions.
To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.
You cannot use python code in django template. This is by design, Django's idea of template is to isolate the presentation logic from the programming code. Save this answer.
Create a new Django projectFrom the main menu, choose File | New | Project, or click the New Project button in the Welcome screen. New Project dialog opens. In the New Project dialog, select Python as a project type. Select a Python SDK that has the Django support enabled.
Here's how I did it on IntelliJ IDEA 14 for Jinja2 templates (similar to Django): Settings > Languages & Frameworks > Python Template Languages
: Select "HTML files" in the list and choose "Jinga2" for Template Language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With