Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm: Forcing Django Template Syntax Highligting

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.

like image 564
andre_b Avatar asked Jan 16 '12 13:01

andre_b


People also ask

How do I override a Django template?

To override these templates, you will need to have an admin folder in your templates folder. If you do not have a templates folder, you can create it in the main project folder. To do so, you will have to change the project's settings.py . Find the TEMPLATES section and modify accordingly.

How do I change the template language in PyCharm?

Configure a template language for a projectOpen the Settings/Preferences dialog, and click the node Python Template Languages. In the Template Languages page, do the following: From the Template language list, select the specific template language to be used in project.

How do you solve template does not exist in Django?

Django TemplateDoesNotExist error means simply that the framework can't find the template file. To use the template-loading API, you'll need to tell the framework where you store your templates. The place to do this is in your settings file ( settings.py ) by TEMPLATE_DIRS setting.


1 Answers

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

like image 125
demalexx Avatar answered Sep 26 '22 09:09

demalexx