def init(cls, site):
        """
        put site settings in the header of the script
        """
        bash_header = ""
        for k,v in site.items():
            bash_header += "%s=%s" % (k.upper(), v)
            bash_header += '\n'
        site['bash_header'] = bash_header

        # TODO: execute before_deploy
        # P.S. running init_before seems like impossible, because the file hasn't been rendered.
        if cls.git_template:
            # do render from git repo
            print "Cloning template files..."
            repo_local_copy = utils.clone_git_repo(cls.git_template_url)
            print "Rendering files from templates..."
            target_path = os.getcwd()
            settings_dir = '/'.join(site['django_settings'].split('.')[:-1])
            site['project_name'] = settings_dir.replace('/', '.')
            settings_dir_path = target_path
            if settings_dir:
                settings_dir_path +=  '/' + settings_dir
            utils.render_from_repo(repo_local_copy, target_path, site, settings_dir_path)
        else:
            cls._create_configs(site)
        print cls.setup_instructions
        # TODO: execute after_deploy
        run_hooks('init_after')
def init ( cls , site ) : bash_header = "" for k , v in site . items ( ) : bash_header += "%s=%s" % ( k . upper ( ) , v ) bash_header += '\n' site [ 'bash_header' ] = bash_header if cls . git_template : print "Cloning template files..." repo_local_copy = utils . clone_git_repo ( cls . git_template_url ) print "Rendering files from templates..." target_path = os . getcwd ( ) settings_dir = '/' . join ( site [ 'django_settings' ] . split ( '.' ) [ : - 1 ] ) site [ 'project_name' ] = settings_dir . replace ( '/' , '.' ) settings_dir_path = target_path if settings_dir : settings_dir_path += '/' + settings_dir utils . render_from_repo ( repo_local_copy , target_path , site , settings_dir_path ) else : cls . _create_configs ( site ) print cls . setup_instructions run_hooks ( 'init_after' )
put site settings in the header of the script