sbin/sync/fabfile.py
changeset 642 b419e891b0bd
parent 641 7d5640606813
child 668 b52724db32ab
equal deleted inserted replaced
641:7d5640606813 642:b419e891b0bd
   116 
   116 
   117 def do_create_virtualenv(remote_venv_export_path, remotevirtualenvpath):
   117 def do_create_virtualenv(remote_venv_export_path, remotevirtualenvpath):
   118     print("Create virtualenv export_path : %s - remote venvpath : %s" % (remote_venv_export_path, remotevirtualenvpath))
   118     print("Create virtualenv export_path : %s - remote venvpath : %s" % (remote_venv_export_path, remotevirtualenvpath))
   119     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
   119     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
   120     if "remote_baseline_venv" in env and env.remote_baseline_venv:
   120     if "remote_baseline_venv" in env and env.remote_baseline_venv:
   121         prefix_str = os.path.join(env.remote_baseline_venv, "bin/activate")
   121         prefix_str = "source \"%s\"" % os.path.join(env.remote_baseline_venv, "bin/activate")
   122     else:
   122     else:
   123         prefix_str = "echo"
   123         prefix_str = "echo"
   124     run("mkdir -p \"%s\"" % remotevirtualenvpath)
   124     run("mkdir -p \"%s\"" % remotevirtualenvpath)
   125     with prefix(prefix_str), cd(os.path.join(remote_venv_export_path,"virtualenv","web")):
   125     with prefix(prefix_str), cd(os.path.join(remote_venv_export_path,"virtualenv","web")):
   126         run("python create_python_env.py")
   126         run("python create_python_env.py")
   148     rsync_export(web_path, env.remote_web_path, env.web_rsync_filters)    
   148     rsync_export(web_path, env.remote_web_path, env.web_rsync_filters)    
   149 
   149 
   150 def relaunch_server():
   150 def relaunch_server():
   151     print("Relaunch server")
   151     print("Relaunch server")
   152     collectstatic(env.remote_web_path, env.remote_virtualenv_path)
   152     collectstatic(env.remote_web_path, env.remote_virtualenv_path)
   153     sudo(env.web_relaunch_cmd)
   153     sudo(env.web_relaunch_cmd, shell=False)
   154 
   154 
   155 @task
   155 @task
   156 def sync_web(version):
   156 def sync_web(version):
   157     print(green("sync web with version %s" % version))
   157     print(green("sync web with version %s" % version))
   158     export_path = export_version(version)
   158     export_path = export_version(version)