我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.core.management.base.BaseCommand()。
def fetch_command(self, subcommand, command_sets=None): """ Tries to fetch the given subcommand. If it can't be found, prints a message with the appropriate command called from the command line (e.g. "biohub_cli"). """ # Check if the subcommand is available try: app_name = self.available_commands[subcommand] except KeyError: sys.stderr.write( "Unknown command: %r\nType '%s --help' for usage.\n" % (subcommand, self.prog_name)) sys.exit(1) if isinstance(app_name, BaseCommand): klass = app_name else: klass = load_command_class(app_name, subcommand) return klass