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.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.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.output_transaction

BaseCommand.output_transaction A boolean indicating whether the command outputs SQL statements; if True, the output will automatically be wrapped with BEGIN; and COMMIT;. Default value is False.

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.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.AppCommand.handle_app_config()

AppCommand.handle_app_config(app_config, **options) Perform the command’s actions for app_config, which will be an AppConfig instance corresponding to an application label given on the command line.

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.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.