Ejemplo n.º 1
0
def put_settings(reload_uwsgi=True):
    """Puts Django production settings file to remote and reloads uwsgi."""
    # todo set DEBUG=False automatically
    path_local, path_remote = get_paths('%s/settings/settings_production.py' % PROJECT_NAME)
    create_dir(path.dirname(path_remote))
    fabric_put(path_local, path_remote)

    reload_uwsgi and reload_touch()
Ejemplo n.º 2
0
 def put(self, local_path, remote_path, **kwargs):
     local_path = getattr(local_path, 'name', local_path)
     if self.local_deployment:
         return self.local_put(self.fmt(local_path), self.fmt(remote_path), **kwargs)
     if env.get('use_sudo'):
         kwargs['use_sudo'] = True
     return fabric_put(self.fmt(local_path), self.fmt(remote_path), **kwargs)
Ejemplo n.º 3
0
def put(local_path, remote_path, mode=None, **kwargs):
    """If the host is localhost, puts the file without requiring SSH."""
    require('hosts')
    if 'localhost' in env.hosts:
        if (os.path.isdir(remote_path) and (os.path.join(
                remote_path, os.path.basename(local_path))) == local_path):
            return 0
        result = local('cp -R %s %s' % (local_path, remote_path))
        if mode:
            local('chmod -R %o %s' % (mode, remote_path))
        return result
    else:
        return fabric_put(local_path, remote_path, mode, **kwargs)
Ejemplo n.º 4
0
def put(local_path, remote_path, mode=None, **kwargs):
    """If the host is localhost, puts the file without requiring SSH."""
    require('hosts')
    if 'localhost' in env.hosts:
        if (os.path.isdir(remote_path) and
                (os.path.join(remote_path, os.path.basename(local_path)))
                == local_path):
            return 0
        result = local('cp -R %s %s' % (local_path, remote_path))
        if mode:
            local('chmod -R %o %s' % (mode, remote_path))
        return result
    else:
        return fabric_put(local_path, remote_path, mode, **kwargs)
Ejemplo n.º 5
0
def put(local_path, remote_path, **kwargs):
    formatted = None
    if 'putstr' in kwargs:
        formatted = kwargs.pop('putstr').format(**env)
    elif kwargs.pop('template', False) is True:
        with open(local_path) as file:
            formatted = file.read().format(**env)

    if formatted is not None:
        (fd, filename) = tempfile.mkstemp()
        with open(filename, 'w') as file:
            file.write(formatted)
            file.flush()
    else:
        filename = local_path
    return fabric_put(filename, remote_path, **kwargs)