window下解决fastdfs_client安装报错问题

FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等(摘自百度百科).
实验环境:
1.docker下运行单节点的跟踪器(tracker)和存储节点(storage)
2.windows10 上运行Python环境: 3.6.4
3.IDE:Pychram
==============================================
安装fastdfs_client
1. 安装fdfs_client-py-1.2.6
(下载地址:http://down.51cto.com/data/2448725)
解压之后使用python setup.py install命令安装,或解压直接将fdfs_client文件夹拷贝到Python/lib目录下即可

window下解决fastdfs_client安装报错问题

2. 修改Python/Lib/fdfs_client/storage_client.py文件,将12行删除或注释(否则,使用时会报错ImportError: No module named sendfile)
# from fdfs_client.sendfile import *

安装完windows下环境:
(上面方法安装):fdfs_client 
网络安装:
pip install mutagen
pip isntall requests
Python manage.py shell环境测试:

window下解决fastdfs_client安装报错问题


from fdfs_client.client import Fdfs_client
client = Fdfs_client('配置文件绝对路径')

上传OK !!!!

坑点:
1.storage.client,注释12行
2.测试上传文件绝对路径需要进行 r 转义,不然报Unicode错误
3.如果通过网络安装(pip) fdfs_client,会有如下报错,不要盲目安装VC++ 14.0 ,
可以先去 控制面板==>>程序==>>程序和功能 查看是否安装过:

window下解决fastdfs_client安装报错问题


===================================
# fastdfs 配置文件:client.config
============client.config==============
# (注意标黄配置)
# connect timeout in seconds
# default value is 30s
connect_timeout=30

# network timeout in seconds
# default value is 30s
network_timeout=60

# the base path to store log files
base_path= ../../logs  # 日志存放

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.115.129:22122  # tracker服务器

#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info

# if use connection pool
# default value is false
# since V4.05
use_connection_pool = false

# connections whose the idle time exceeds this time will be closed
# unit: second
# default value is 3600
# since V4.05
connection_pool_max_idle_time = 3600

# if load FastDFS parameters from tracker server
# since V4.05
# default value is false
load_fdfs_parameters_from_tracker=false

# if use storage ID instead of IP address
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# default value is false
# since V4.05
use_storage_id = false

# specify storage ids filename, can use relative or absolute path
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# since V4.05
storage_ids_filename = storage_ids.conf

#HTTP settings
http.tracker_server_port=80

#use "#include" directive to include HTTP other settiongs
##include http.conf
(发现错误,若有疑问,欢迎评论交流)

写在有道云笔记中的文档链接:
https://note.youdao.com/share/?id=da3d2b54f99a916854d3383b4e2ecee8&type=note#/

猜你喜欢

转载自blog.51cto.com/10412806/2133498