使用Fabric在DigitalOcean上部署夹层站点

时间:2018-05-26 19:29:27

标签: rsync mezzanine

我正在尝试部署我的夹层网站并使用CASE 1(到新服务器)跟踪此tutorial

  • 1-3一切似乎都很好(显然不是),直到我进入第4步
  • 4-运行fab all

该过程安装virtualenvs,并在其中包含我的项目名称,然后我收到此错误:

  

[1xx.xx.xxx.xx] out:/home/~/.virtualenvs/blog_iq/bin/python [1xx.xx.xxx.xx]中的新python可执行文件:   安装setuptools,pip,wheel ......完成。 [1xx.xx.xxx.xx]]出:   [1xx.xx.xxx.xx]] rsync_project:rsync --exclude“ .pyc”--exclude   “ .pyo”--exclude“* .db”--exclude“.DS_Store”--exclude“.coverage”   --exclude“local_settings.py”--exclude“/ static”--exclude“/.git”--exclude“/.hg”-pthrvz --rsh ='ssh -p 22'C:\ Users \〜\根\ 2blog \ blog_iq \
  user@1xx.xxx.xx:/家庭/用户/夹层/ blog_iq

     

[localhost] local:rsync --exclude“ .pyc”--exclude“ .pyo”   --exclude“* .db”--exclude“.DS_Store”--exclude“.coverage”--exclude“local_settings.py”--exclude“/ static”--exclude“/.git”--exclude   “/.hg”-pthrvz --rsh ='ssh -p 22'C:\ Users \〜\ Root \ 2blog \ blog_iq \
  user@1xx.xxx.xx:/家庭/用户/夹层/ blog_iq

     

源和目标不能都是远程的。 rsync错误:语法   或使用错误(代码1)在main.c(1292)[Receiver = 3.1.2]

     

致命错误:local()遇到错误(返回代码1)   执行'rsync --exclude“ .pyc”--exclude“ .pyo”--exclude“* .db”   --exclude“.DS_Store”--exclude“.coverage”--exclude“local_settings.py”--exclude“/ static”--exclude“/.git”--exclude   “/.hg”-pthrvz --rsh ='ssh -p 22'C:\ Users \〜\ Root \ 2blog \ blog_iq \
  user@1xx.xxx.xx:/家庭/用户/夹层/ blog_iq

     

中止。断开1xx.xxx.xx ...完成。

我很乐意在安装时发布由夹层生成的整个fabfile.py,但这是一个冗长的,我从来没有碰过它,除了寻找生成这个打印输出的代码,它似乎在这里:

################
# Config setup #
################

if not hasattr(env, "proj_app"):
    env.proj_app = real_project_name("blog_iq")

conf = {}
if sys.argv[0].split(os.sep)[-1] in ("fab", "fab-script.py"):
    # Ensure we import settings from the current dir
    try:
        conf = import_module("%s.settings" % env.proj_app).FABRIC
        try:
            conf["HOSTS"][0]
        except (KeyError, ValueError):
            raise ImportError
    except (ImportError, AttributeError):
        print("Aborting, no hosts defined.")
        exit()


env.db_pass = conf.get("DB_PASS", None)
env.admin_pass = conf.get("ADMIN_PASS", None)
env.user = conf.get("SSH_USER", getuser())
env.password = conf.get("SSH_PASS", None)
env.key_filename = conf.get("SSH_KEY_PATH", None)
env.hosts = conf.get("HOSTS", [""])

env.proj_name = conf.get("PROJECT_NAME", env.proj_app)
env.venv_home = conf.get("VIRTUALENV_HOME", "/home/%s/.virtualenvs" % env.user)
env.venv_path = join(env.venv_home, env.proj_name)
env.proj_path = "/home/%s/mezzanine/%s" % (env.user, env.proj_name)
env.manage = "%s/bin/python %s/manage.py" % (env.venv_path, env.proj_path)
env.domains = conf.get("DOMAINS", [conf.get("LIVE_HOSTNAME", env.hosts[0])])
env.domains_nginx = " ".join(env.domains)
env.domains_regex = "|".join(env.domains)
env.domains_python = ", ".join(["'%s'" % s for s in env.domains])
env.ssl_disabled = "#" if len(env.domains) > 1 else ""
env.vcs_tools = ["git", "hg"]
env.deploy_tool = conf.get("DEPLOY_TOOL", "rsync")
env.reqs_path = conf.get("REQUIREMENTS_PATH", None)
env.locale = conf.get("LOCALE", "en_US.UTF-8")
env.num_workers = conf.get("NUM_WORKERS",
                           "multiprocessing.cpu_count() * 2 + 1")

env.secret_key = conf.get("SECRET_KEY", "")
env.nevercache_key = conf.get("NEVERCACHE_KEY", "")

if not env.secret_key:
    print("Aborting, no SECRET_KEY setting defined.")
    exit()


# Remote git repos need to be "bare" and reside separated from the project
if env.deploy_tool == "git":
    env.repo_path = "/home/%s/git/%s.git" % (env.user, env.proj_name)
else:
    env.repo_path = env.proj_path

在这里

def rsync_upload():
    """
    Uploads the project with rsync excluding some files and folders.
    """
    excludes = ["*.pyc", "*.pyo", "*.db", ".DS_Store", ".coverage",
                "local_settings.py", "/static", "/.git", "/.hg"]
    local_dir = os.getcwd() + os.sep
    return rsync_project(remote_dir=env.proj_path, local_dir=local_dir,
                         exclude=excludes)

1 个答案:

答案 0 :(得分:0)

不幸的是,C:CygWin解释为远程服务器,因为该列。

我认为您必须与rsync一起安装/cygdrive/c/...:然后使用类似CygWin的路径:{{1}}