def deploy_sandbox_shared_setup(log, verbose=True, app=None, exp_config=None):
if verbose:<EOL><INDENT>out = None<EOL><DEDENT>else:<EOL><INDENT>out = open(os.devnull, "<STR_LIT:w>")<EOL><DEDENT>config = get_config()<EOL>if not config.ready:<EOL><INDENT>config.load()<EOL><DEDENT>heroku.sanity_check(config)<EOL>(id, tmp) = setup_experiment(log, debug=False, app=app, exp_config=exp_config)<EOL>if config.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>log("<STR_LIT>")<EOL>registration.register(id, snapshot=None)<EOL><DEDENT>log("<STR_LIT>")<EOL>heroku.log_in()<EOL>config.set("<STR_LIT>", heroku.auth_token())<EOL>log("<STR_LIT>", chevrons=False)<EOL>cwd = os.getcwd()<EOL>os.chdir(tmp)<EOL>git = GitClient(output=out)<EOL>git.init()<EOL>git.add("<STR_LIT>")<EOL>git.commit('<STR_LIT>'.format(id))<EOL>log("<STR_LIT>")<EOL>team = config.get("<STR_LIT>", None)<EOL>heroku_app = HerokuApp(dallinger_uid=id, output=out, team=team)<EOL>heroku_app.bootstrap()<EOL>heroku_app.buildpack("<STR_LIT>")<EOL>database_size = config.get("<STR_LIT>")<EOL>redis_size = config.get("<STR_LIT>")<EOL>addons = [<EOL>"<STR_LIT>".format(quote(database_size)),<EOL>"<STR_LIT>".format(quote(redis_size)),<EOL>"<STR_LIT>",<EOL>]<EOL>if config.get("<STR_LIT>"):<EOL><INDENT>addons.append("<STR_LIT>")<EOL><DEDENT>for name in addons:<EOL><INDENT>heroku_app.addon(name)<EOL><DEDENT>heroku_config = {<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>}<EOL>heroku_app.set_multiple(**heroku_config)<EOL>log("<STR_LIT>")<EOL>ready = False<EOL>while not ready:<EOL><INDENT>try:<EOL><INDENT>r = redis.from_url(heroku_app.redis_url)<EOL>r.set("<STR_LIT:foo>", "<STR_LIT:bar>")<EOL>ready = True<EOL><DEDENT>except (ValueError, redis.exceptions.ConnectionError):<EOL><INDENT>time.sleep(<NUM_LIT:2>)<EOL><DEDENT><DEDENT>log("<STR_LIT>")<EOL>config.extend(<EOL>{<EOL>"<STR_LIT>": heroku_app.url + "<STR_LIT>",<EOL>"<STR_LIT>": heroku_app.db_url,<EOL>}<EOL>)<EOL>config.write()<EOL>git.add("<STR_LIT>")<EOL>time.sleep(<NUM_LIT>)<EOL>git.commit("<STR_LIT>")<EOL>time.sleep(<NUM_LIT>)<EOL>log("<STR_LIT>")<EOL>git.push(remote="<STR_LIT>", branch="<STR_LIT>")<EOL>log("<STR_LIT>")<EOL>size = config.get("<STR_LIT>")<EOL>for process in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>qty = config.get("<STR_LIT>" + process)<EOL>heroku_app.scale_up_dyno(process, qty, size)<EOL><DEDENT>if config.get("<STR_LIT>"):<EOL><INDENT>heroku_app.scale_up_dyno("<STR_LIT>", <NUM_LIT:1>, size)<EOL><DEDENT>time.sleep(<NUM_LIT:8>)<EOL>log("<STR_LIT>")<EOL>launch_data = _handle_launch_data("<STR_LIT>".format(heroku_app.url), error=log)<EOL>result = {<EOL>"<STR_LIT>": heroku_app.name,<EOL>"<STR_LIT>": heroku_app.url,<EOL>"<STR_LIT>": launch_data.get("<STR_LIT>", None),<EOL>}<EOL>log("<STR_LIT>")<EOL>log("<STR_LIT>".format(result["<STR_LIT>"]), chevrons=False)<EOL>log("<STR_LIT>")<EOL>log(result["<STR_LIT>"], chevrons=False)<EOL>os.chdir(cwd)<EOL>log("<STR_LIT>" + id + "<STR_LIT:.>")<EOL>return result<EOL>
Set up Git, push to Heroku, and launch the app.