def run(app, argv=sys.argv, extra_args=None):
    """
    Run commands in a plain django environment

    :param app: application
    :param argv: arguments (default to sys.argv)
    :param extra_args: list of extra arguments
    """
    if app not in argv[:2]:
        # app is automatically added if not present
        argv.insert(1, app)
    if len(argv) < 3 and 'test' not in argv[:2]:
        # test argument is given if not argument is passed
        argv.insert(2, 'test')
    if extra_args:
        argv.extend(extra_args)
    return runner(argv)
Run commands in a plain django environment

    :param app: application
    :param argv: arguments (default to sys.argv)
    :param extra_args: list of extra arguments