core.management.BaseCommand.missing_args_message

BaseCommand.missing_args_message If your command defines mandatory positional arguments, you can customize the message error returned in the case of missing arguments. The default is output by argparse (“too few arguments”).

core.management.BaseCommand.leave_locale_alone

BaseCommand.leave_locale_alone A boolean indicating whether the locale set in settings should be preserved during the execution of the command instead of being forcibly set to ‘en-us’. Default value is False. Make sure you know what you are doing if you decide to change the value of this option in your custom command if it creates database content that is locale-sensitive and such content shouldn’t contain any translations (like it happens e.g. with django.contrib.auth permissions) as making

core.management.BaseCommand.help

BaseCommand.help A short description of the command, which will be printed in the help message when the user runs the command python manage.py help <command>.

core.management.BaseCommand.handle()

BaseCommand.handle(*args, **options) [source] The actual logic of the command. Subclasses must implement this method. It may return a Unicode string which will be printed to stdout (wrapped by BEGIN; and COMMIT; if output_transaction is True).

core.management.BaseCommand.get_version()

BaseCommand.get_version() [source] Returns the Django version, which should be correct for all built-in Django commands. User-supplied commands can override this method to return their own version.

core.management.BaseCommand.execute()

BaseCommand.execute(*args, **options) [source] Tries to execute this command, performing system checks if needed (as controlled by the requires_system_checks attribute). If the command raises a CommandError, it’s intercepted and printed to stderr. Calling a management command in your code execute() should not be called directly from your code to execute a command. Use call_command() instead.

core.management.BaseCommand.check()

BaseCommand.check(app_configs=None, tags=None, display_num_errors=False) [source] Uses the system check framework to inspect the entire Django project for potential problems. Serious problems are raised as a CommandError; warnings are output to stderr; minor notifications are output to stdout. If app_configs and tags are both None, all system checks are performed. tags can be a list of check tags, like compatibility or models.

core.management.BaseCommand.can_import_settings

BaseCommand.can_import_settings A boolean indicating whether the command needs to be able to import Django settings; if True, execute() will verify that this is possible before proceeding. Default value is True.

core.management.BaseCommand.add_arguments()

BaseCommand.add_arguments(parser) [source] Entry point to add parser arguments to handle command line arguments passed to the command. Custom commands should override this method to add both positional and optional arguments accepted by the command. Calling super() is not needed when directly subclassing BaseCommand.

core.management.BaseCommand

class BaseCommand [source] The base class from which all management commands ultimately derive. Use this class if you want access to all of the mechanisms which parse the command-line arguments and work out what code to call in response; if you don’t need to change any of that behavior, consider using one of its subclasses. Subclassing the BaseCommand class requires that you implement the handle() method.