package documentation

Undocumented

Module base Base classes for writing management commands (named commands which can be executed through django-admin or manage.py).
Module color Sets up the terminal color scheme.
Package commands Undocumented
Module sql No module docstring; 1/3 function documented
Module templates No module docstring; 1/1 class documented
Module utils No module docstring; 7/8 functions documented

From __init__.py:

Function call​_command Call the given command, with the given options and args/kwargs.
Class ​Management​Utility Encapsulate the logic of the django-admin and manage.py utilities.
Function execute​_from​_command​_line Run a ManagementUtility.
Function find​_commands Given a path to a management directory, return a list of all the command names that are available.
Function get​_commands Return a dictionary mapping command names to their callback applications.
Function load​_command​_class Given a command name and an application name, return the Command class instance. Allow all errors raised by the import process (ImportError, AttributeError) to propagate.
def find_commands(management_dir):
Given a path to a management directory, return a list of all the command names that are available.
def load_command_class(app_name, name):
Given a command name and an application name, return the Command class instance. Allow all errors raised by the import process (ImportError, AttributeError) to propagate.
@functools.lru_cache(maxsize=None)
def get_commands():

Return a dictionary mapping command names to their callback applications.

Look for a management.commands package in django.core, and in each installed application -- if a commands package exists, register all commands in that package.

Core commands are always included. If a settings module has been specified, also include user-defined commands.

The dictionary is in the format {command_name: app_name}. Key-value pairs from this dictionary can then be used in calls to load_command_class(app_name, command_name)

If a specific version of a command must be loaded (e.g., with the startapp command), the instantiated module can be placed in the dictionary in place of the application name.

The dictionary is cached on the first call and reused on subsequent calls.

def call_command(command_name, *args, **options):

Call the given command, with the given options and args/kwargs.

This is the primary API you should use for calling specific commands.

command_name may be a string or a command object. Using a string is preferred unless the command object is required for further processing or testing.

Some examples:

call_command('migrate') call_command('shell', plain=True) call_command('sqlmigrate', 'myapp')

from django.core.management.commands import flush cmd = flush.Command() call_command(cmd, verbosity=0, interactive=False) # Do something with cmd ...

def execute_from_command_line(argv=None):
Run a ManagementUtility.