Difference between revisions of "Django"
(→Django-mode: insert translation marks) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
They are in the [[Python]] page. | 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. | + | '''Elpy''' supports '''running tests with the Django runner'''. We can then run the unit test we are currently in. See [https://elpy.readthedocs.io/en/latest/ide.html#testing its documentation] to make it work with either <code>django-admin.py</code> (the default) or the <code>manage.py</code> of your project. |
With Projectile we can quickly find files in the project, switch between source and test files. | With Projectile we can quickly find files in the project, switch between source and test files. | ||
Line 17: | Line 17: | ||
[https://github.com/myfreeweb/django-mode django-mode] (in MELPA) features: | [https://github.com/myfreeweb/django-mode django-mode] (in MELPA) features: | ||
− | * templates '''syntax highlighting''', | + | * templates '''syntax highlighting''' (<code>M-x django-html-mode</code>), |
* '''quick commands''': insert translation marks ('''C-t''', both in python and html sources), | * '''quick commands''': insert translation marks ('''C-t''', both in python and html sources), | ||
* commands to '''jump to the corresponding test file''', | * commands to '''jump to the corresponding test file''', | ||
− | * '''run management commands''', with fuzzy completion of the command and default arguments, | + | * '''run management commands''', with fuzzy completion of the command and default arguments (bound to '''C-c m''', <code>django-manage</code>). A new menu shows commands and keyboard shortcuts. |
− | * '''run a Make target''', with same completion | + | * '''run a Make target''', with same completion (bound to '''C-c M''', <code>django-make</code>) |
=== snippets === | === snippets === | ||
Line 39: | Line 39: | ||
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. | 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. | ||
+ | |||
+ | |||
+ | [[Category:Programming]] | ||
+ | [[Category:Third Party Package]] |
Latest revision as of 13:04, 19 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. See its documentation to make it work with either django-admin.py
(the default) or the manage.py
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
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
)
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.