>>> from fdfs_client.client import Fdfs_client >>> client = Fdfs_client('meiduo_mall/utils/fastdfs/c

使用shell 运行FastDFS客户端时,执行下面三条命令:

    1.from fdfs_client.client import Fdfs_client
    2. client = Fdfs_client('male/utils/fastdfs/client.conf')
    3. ret = client.upload_by_filename('/home/python/Desktop/01.jpeg')

执行第三条的时候报错误:

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/python/.virtualenvs/py_django/lib/python3.5/site-packages/fdfs_client/client.py", line 90, in upload_by_filename
    store_serv = tc.tracker_query_storage_stor_without_group()
  File "/home/python/.virtualenvs/py_django/lib/python3.5/site-packages/fdfs_client/tracker_client.py", line 381, in tracker_query_storage_stor_without_group
    raise DataError('[-] Error: %d, %s' % (th.status, os.strerror(th.status)))
fdfs_client.exceptions.DataError: [-] Error: 2, No such file or directory

错误的原因是: 开启storage服务ip设置错误

docker run -dti --network=host --name storage -e TRACKER_SERVER=ip地址:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage
TRACKER_SERVER=本机的ip地址:22122 本机ip地址不要使用127.0.0.1
这里是将fastDFS storage运行目录映射到本机的/var/fdfs/storage目录中

你可能感兴趣的:(Docker)