From WikEmacs
Jump to navigation Jump to search

What are the packages that help for Django development in Emacs ?

Know the python tools

They are in the Python page.

Elpy supports running tests with the Django runner. We can then run the unit test we are currently in. See its documentation to make it work with either (the default) or the of your project.

With Projectile we can quickly find files in the project, switch between source and test files.

With the usual virtual-environments support we can switch venvs, run a Makefile compilation target in it, etc.

Django modes


django-mode (in MELPA) features:

  • templates syntax highlighting (M-x django-html-mode),
  • quick commands: insert translation marks (C-t, both in python and html sources),
  • commands to jump to the corresponding test file,
  • run management commands, with fuzzy completion of the command and default arguments (bound to C-c m, django-manage). A new menu shows commands and keyboard shortcuts.
  • run a Make target, with same completion (bound to C-c M, django-make)


This mode also include snippets for yasnippet.


Python-django (in MELPA, by the creator of python-mode) has the following features:

  • File navigation (per app, STATIC_ROOT, MEDIA_ROOT and TEMPLATE_DIRS),
  • Etag building,
  • Grep in project,
  • Quick jump (to settings, project root, virtualenv and docs),
  • Management commands: You can run any management command from the project buffer via python-django-mgmt-run-command or via the quick management commands accesible from the Django menu. Completion is provided for all arguments and you can cycle through opened management command process buffers very easily. `sql-mode' will be used.
  • Quick management commands.

Another cool feature is that comint processes (the general mode for repls) are spiced up with special processing, for instance if you are using runserver and get a breakpoint via pdb or ipdb then the pdb-tracking provided by python-mode will trigger or if you enter dbshell the proper sql-mode will be used.