I use Eclipse and pydev for django development. This has worked more or less ok, including debugging. Syntax highlighting doesn't seem to work everywhere though. I couldn't get any highlighting for the templates thought. Is there a way to get the highlighting and code suggestions for the templates?
-
Possible duplicate: http://stackoverflow.com/q/1670643/151299 – Oben Sonne Sep 10 '12 at 13:45
5 Answers

- 4,217
- 3
- 35
- 45
-
2+1 This is by far the best solution, for me at least. Also works for Jinja2 templates, as they have essentially the same syntax. – vergenzt May 12 '13 at 22:18
-
1
-
The bug @donturner mentioned also extends to opening templates which contain django template logic in attributes. – ChrisR Nov 27 '13 at 17:55
-
2Just to add that the plugin is now fixed, and it's awesome. I even use it for plain old HTML highlighting. – donturner Dec 23 '14 at 10:55
For clarity
Django Templates Editor is only available with Aptana 3.0 and later. Pydev in eclipse alone does not support it. Aptana is available as an eclipse plugin or stand alone.
As mentioned by mcoconnor Window -> Preferences -> General -> Editor -> File Associations will give you a list of extensions.
- Choose *.html as the file type
- Select HTML.Django Templates Editor (Aptana) from Associated editors
- Click Default.
- Reload any html files you had open in the editor
This should make Aptana treat the Django specific markup correctly instead of reporting errors and also will offer code completion.

- 2,280
- 1
- 26
- 33
-
I found it unintuitive to install aptana as an eclipse plugin. At the moment, you go here: http://aptana.org/products/studio3/download then click the "eclipse plug-in version" radio button. – Steve Bennett Nov 10 '11 at 22:04
The current recommended way of having a Django Templates Editor with PyDev is by using LiClipse: http://www.liclipse.com (which is a commercial counterpart made to keep PyDev supported -- as such it has PyDev standalone and a bunch of other goodies builtin).
Note that by default the html editor in LiClipse is bound to .html and the django templates to .djhtml, so, you can either:
- open with > LiClipse Django Editor
- right-click an open editor > languages > Django
Or you can change the default association in:
- window > preferences > general > editors > file associations > *.html
- add LiClipse Django editor > set it as default.

- 24,814
- 4
- 66
- 78
The latest PyDev versions include a Django template editor, but it's not compatible with vanilla Eclipse. You have to use Aptana Studio instead.
Just use http://pydev.org/nightly as update URL, the PyDev and Django template editor packages should be there.

- 68,631
- 21
- 159
- 205
-
1Personally, I found Aptana studio quite invasive. For instance, the way it changes the window fonts, without taking into account of the Eclipse settings, and in general the feeling that it was not using standard Eclipse interface and approach. – rob Mar 02 '11 at 21:08
-
6@Roberto: I didn't say Aptana was good. Actually I also prefer standard Eclipse myself, HTML highlighting is enough for me. (If Django templates grow so complex that you need highlighting, you're doing it wrong.) – AndiDog Mar 02 '11 at 21:15
If you install the Eclipse Web Tools Platform (WTP), it bundles a nice HTML editor, which does 95% of the syntax highlighting you'd want in a Django template. It also includes editors for other common web types, like JS and CSS, which are often nice when working with Django projects. This will also give you code completion and automatic tag closing for the HTML elements, at least.
If you use a .html extension on your template files, you'll probably get the right editor by default when you open them up, but if not, you can associate the HTML Editor with whatever extension you use in the Window -> Preferences -> General -> Editor -> File Associations interface.

- 9,742
- 3
- 37
- 49
-
5well, the 5% remaining are the django templating syntax that I'm missing. – abolotnov Mar 02 '11 at 21:11