python3与fastdfs分布式文件系统交互
一、先配置好自己的分布式文件系统,参考另一篇文章:
https://www.cnblogs.com/vevian/p/13170228.html
二、安装第三方库py3Fdfs
pip install py3Fdfs
三、实际应用,参考文档
https://pypi.org/project/py3Fdfs/
from fdfs_client.client import get_tracker_conf, Fdfs_client # client.conf配置文件路径 conf = get_tracker_conf(r‘client.conf‘) client = Fdfs_client(conf) # 文件路径 result = client.upload_appender_by_filename(r‘U01.png‘) print(result)
注意:client.conf是从fdfs服务器上复制到django代码机器上的文件,需要将里面的base_path路径修改成存放client.conf的路径
四、执行结果
{‘Group name‘: b‘group1‘, ‘Remote file_id‘: b‘group1/M00/00/00/wKg0hV7vNJCEBJ0PAAAAALU5g1M201.png‘, ‘Status‘: ‘Upload successed.‘, ‘Local file name‘: ‘E:\\photo\\IU01.png‘, ‘Uploaded size‘: ‘336.09KB‘, ‘Storage IP‘: b‘192.168.52.133‘} Process finished with exit code 0
相关推荐
isHooky 2020-05-05
zhangll00 2020-02-12
憧憬 2019-12-20
亦碎流年 2019-12-05
weiyawen 2019-11-13
lovejk 2019-11-10
MichaelHsu 2019-06-03
Dreamya 2019-06-10
ahaoGG 2017-01-20
MichaelHsu 2012-05-31
YZR 2020-04-14
Cheetahcubs 2020-02-23
亦碎流年 2019-12-29
Cheetahcubs 2020-01-07
Cheetahcubs 2019-12-27
loviezhang 2019-12-26
Cheetahcubs 2019-12-23