Difference between revisions of "Django"

From WikEmacs
Jump to navigation Jump to search
Line 15: Line 15:
 
== Django-mode ==
 
== Django-mode ==
  
[https://github.com/myfreeweb/django-mode django-mode] (in MELPA) offers some utilities, like commands to jump to tests, to run management commands, etc.
+
[https://github.com/myfreeweb/django-mode django-mode] (in MELPA) features:
 +
 
 +
* commands to '''jump to the corresponding test file''',  
 +
* '''run management commands''', with fuzzy completion of the command and default arguments,
 +
* '''run a Make target''', with same completion
  
 
=== snippets ===
 
=== snippets ===

Revision as of 12:40, 17 May 2017

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) features:

  • commands to jump to the corresponding test file,
  • run management commands, with fuzzy completion of the command and default arguments,
  • run a Make target, with same completion

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.