Example #1
0
def render_settings_template():
    try:
        env.non_template_exts
    except NameError:
       env.non_template_exts = []
    except AttributeError:
       env.non_template_exts = []

    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for root, dirs, files in os.walk(source_dir):
        relative_path = os.path.relpath(root, source_dir)

        for conf_file in files:
            conf_file = os.path.join(relative_path, conf_file)
            file_extension = os.path.splitext(conf_file)[1]

            if file_extension in env.non_template_exts:
                shutil.copy(os.path.join(source_dir, conf_file),
                             os.path.join(target_dir, conf_file))
            else:
                template_to_file(os.path.join(source_dir, conf_file),
                             os.path.join(target_dir, conf_file),
                             context)

    env.deploy_config_dir = target_dir
Example #2
0
def render_settings_template():
    try:
        env.non_template_exts
    except NameError:
        env.non_template_exts = []
    except AttributeError:
        env.non_template_exts = []

    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for conf_file in os.listdir(source_dir):
        file_name, file_extension = os.path.splitext(conf_file)
        if file_extension in env.non_template_exts:
            shutil.copy(os.path.join(source_dir, conf_file),
                        os.path.join(target_dir, conf_file))
        else:
            template_to_file(os.path.join(source_dir, conf_file),
                             os.path.join(target_dir, conf_file), context)

    env.deploy_config_dir = target_dir
Example #3
0
def render_settings_template():
    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for conf_file in os.listdir(source_dir):
        template_to_file(os.path.join(source_dir, conf_file),
                         os.path.join(target_dir, conf_file),
                         context)

    env.deploy_config_dir = target_dir
Example #4
0
def render_settings_template():
    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for root, dirs, files in os.walk(source_dir):
        relative_path = os.path.relpath(root, source_dir)
        for file in files:
            conf_file = os.path.join(relative_path, file)
            template_to_file(os.path.join(source_dir, conf_file),
                         os.path.join(target_dir, conf_file),
                         context)
        
    env.deploy_config_dir = target_dir
Example #5
0
def render_settings_template():
    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for conf_file in os.listdir(source_dir):
        template_to_file(os.path.join(source_dir, conf_file),
                         os.path.join(target_dir, conf_file), context)

    # Need to copy target_dir/etc and it's subdirectories to /etc/ for
    # the application configuration
    #shutil.copytree(os.path.join(target_dir, "etc"), "/etc")

    env.deploy_config_dir = target_dir
Example #6
0
def render_settings_template(debug=False):
    """
    Render a settings file from a template in a local checkout.
    """

    require("tempdir", "project_path", "settings_vars")

    source = os.path.join(env.tempdir, "local_settings.py.template")
    target = os.path.join(env.tempdir, "local_settings.py")
    context = utils.template_context(env.settings_vars)

    # Treat as a string even though it's going to be rendered as unquoted.
    # Clobbers anything from env in the project's own fabfile because the
    # default should always be False.
    if "%s" % debug in ["True", "False"]:
        context["DEBUG"] = debug
    else:
        abort("local_settings.DEBUG may only be True or False")

    utils.template_to_file(source, target, context)
Example #7
0
def render_settings_template():
    tempdir = tempfile.mkdtemp()
    local("tar -C'%s' -xzf '%s'" % (tempdir, env.app_config_archive))

    source_dir = os.path.join(tempdir, 'config')
    target_dir = os.path.join(tempdir, 'processed-config')

    os.mkdir(target_dir)
    context = template_context(env.settings_vars)

    for conf_file in os.listdir(source_dir):
        template_to_file(os.path.join(source_dir, conf_file),
                         os.path.join(target_dir, conf_file),
                         context)

    # Need to copy target_dir/etc and it's subdirectories to /etc/ for
    # the application configuration
    #shutil.copytree(os.path.join(target_dir, "etc"), "/etc")

    env.deploy_config_dir = target_dir
Example #8
0
def render_settings_template(debug=False):
    """
    Render a settings file from a template in a local checkout.
    """

    require("tempdir", "project_path", "settings_vars")

    source = os.path.join(env.tempdir, "local_settings.py.template")
    target = os.path.join(env.tempdir, "local_settings.py")
    context = utils.template_context(env.settings_vars)

    # Treat as a string even though it's going to be rendered as unquoted.
    # Clobbers anything from env in the project's own fabfile because the
    # default should always be False.
    if "%s" % debug in ["True", "False"]:
        context["DEBUG"] = debug
    else:
        abort("local_settings.DEBUG may only be True or False")

    utils.template_to_file(source, target, context)