Django

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.

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

django-mode (in MELPA) offers some utilities, like commands to jump to tests, to run management commands, etc.

snippets

This mode also include snippets for yasnippet.

Python-django

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.