Python 未找到主机。请使用exists函数指定

Python 未找到主机。请使用exists函数指定,python,fabric,Python,Fabric,我目前正在尝试运行一个小的fabric脚本。我在运行exists fabric函数时收到以下消息:“找不到主机。请指定…” 我这样定义了我的主机: env.roledefs.update({ 'app' : [ 'my_host', ], }) 然后我调用这个函数: @roles("app") def update_django(): django_dir = ... if exis

我目前正在尝试运行一个小的fabric脚本。我在运行exists fabric函数时收到以下消息:“找不到主机。请指定…”

我这样定义了我的主机:

env.roledefs.update({
            'app' : [
                'my_host',
            ],
        })
然后我调用这个函数:

@roles("app")
def update_django():
    django_dir = ...
    if exists(django_dir):

我不明白他为什么要找主持人。。。应该感谢@roles decorator来定义它。

使用hosts decorator时它能工作吗

@hosts("my_hostname")
def update_django():
    django_dir = ...
    if exists(django_dir):
你记得所有的进口货吗

from fabric.api import env, hosts, roles, run

恐怕不行。你能告诉我你对织物的要求是什么吗?例如,如果存在,下面是什么():哦,实际上是我的错。我的布料版本没有这个装饰器。对不起。