How to use the honcho.environ function in honcho

To help you get started, we’ve selected a few honcho examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nickstenning / honcho / tests / test_environ.py View on Github external
def test_environ_parse(content, commands):
    content = textwrap.dedent(content)
    result = environ.parse(content)
    assert result == commands
github nickstenning / honcho / honcho / command.py View on Github external
def _read_env(app_root, env):
    files = [e.strip() for e in env.split(',')]
    content = []
    for envfile in files:
        try:
            with open(os.path.join(app_root, envfile)) as f:
                content.append(f.read())
        except IOError:
            pass

    return environ.parse('\n'.join(content))
github idrdex / star-django / stargeo / __init__.py View on Github external
def load_env(filename):
    manage_dir = os.path.dirname(__file__)
    env_file = os.path.join(manage_dir, filename)

    env = honcho.environ.parse(open(env_file).read())
    for key, value in env.items():
        os.environ.setdefault(key, value)
github idrdex / star-django / fabfile.py View on Github external
def backup_db():
    """This is designed to be run locally on backup target"""
    app_env = honcho.environ.parse(open('.env').read())
    db = dj_database_url.parse(app_env['DATABASE_URL'])

    with hide('stderr'):
        local(DUMP_COMMAND % db)

    local("mkdir -p ../db-backups")
    local("rdiff-backup --include ./stargeo.sql.gz --exclude '**' . ../db-backups")
    local("rdiff-backup --remove-older-than 30B ../db-backups")
    local("rm stargeo.sql.gz")