Description
In Django, a command is an argument to the django-admin
or manage.py
cli's which exposes some functionality.
Commands are defined with classes which subclass django.core.management.base.BaseCommand
.
In order to be discoverable by django, the commands must also be defined using the following file-directory pattern 1:
polls/
__init__.py
models.py
management/
__init__.py
commands/
__init__.py
_private.py
closepoll.py
tests.py
views.py
The core commands distributed with django are defined in this manner at django.core.management.commands
.
At present, we have used an alternative approach where we inject our custom commands into our own cli with overwritten fetch_command
and main_help_text
methods on the LitManagementUtility
(which provides the litdjango
cli).
This implementation breaks the functions found at:
from django.core.management import get_commands, find_commands, call_command
which are mostly used internally and for testing in django.
We should probably refactor this at some point.