'Set up any environment changes requested (e.g., Python path
and Django settings), then run this command. If the
command raises a ``CommandError``, intercept it and print it sensibly
to stderr. If the ``--traceback`` option is present or the raised
``Exception`` is not ``CommandError``, raise it.'

def run_from_argv(self, argv):

    self._called_from_command_line = True
    parser = self.create_parser(argv[0], argv[1])
    options = parser.parse_args(argv[2:])
    cmd_options = vars(options)
    args = cmd_options.pop('args', ())
    handle_default_options(options)
    try:
        self.execute(*args, **cmd_options)
    except Exception as e:
        if (options.traceback or (not isinstance(e, CommandError))):
            raise
        if isinstance(e, SystemCheckError):
            self.stderr.write(str(e), (lambda x: x))
        else:
            self.stderr.write(('%s:    %s' % (e.__class__.__name__, e)))
        sys.exit(1)
    finally:
        with suppress(ImproperlyConfigured):
            connections.close_all()
