How to set target hosts in Fabric file

后端 未结 15 792
南方客
南方客 2020-11-29 15:27

I want to use Fabric to deploy my web app code to development, staging and production servers. My fabfile:

def deploy_2_dev():
  deploy(\'dev\')

def deploy_         


        
15条回答
  •  感动是毒
    2020-11-29 15:50

    It's very simple. Just initialize the env.host_string variable and all of the following commands will be executed on this host.

    from fabric.api import env, run
    
    env.host_string = 'user@exmaple.com'
    
    def foo:
        run("hostname -f")
    

提交回复
热议问题