def call_django(argv=[], production=False):
    if CWD not in sys.path:
        sys.path.insert(0, CWD)
    settings_module = "%s.development" % CONFIGURATION_MODULE
    if production:
        settings_module = "%s.production" % CONFIGURATION_MODULE
    settings = None
    try:
        __import__(settings_module, globals(), locals())
        settings = sys.modules[settings_module]
    except ImportError, e:
        sys.stderr.write("Unable to import %s: %s\n" % (settings_module, e))
        sys.exit(1)
    # django expects unparsed options, so we reset argv with the script name
    # and subcommand
    new_argv = sys.argv[0:2] + argv
    from django.core.management import execute_manager
    execute_manager(settings, argv=new_argv)
dataset/ETHPy150Open armstrong/armstrong.cli/armstrong/cli/main.py/call_django/original