windows下使用 fdfs_client 上传文件
windows 下使用 fdfs_client 实现文件上传1、安装 fdfs_client 模块在 windows 环境下使用 2、修改 fdfs_client/storage_client.py 文件需要修改 fdfs_client 模块中的 storage_client.py 文件,将第12行删除或注释(否则使用时会报错 ImportError: No module named sendfile) 3、安装 mutagen 和 requestspip install mutagen pip isntall requests 4、修改 fastdfs 配置文件: client_config① 修改 base_path 为你 windows 电脑一个真实存在的文件夹 例如: base_path=E:fdfs_log ② 修改 tracker_server 为你 Linux 系统的 IP 地址 + :22122 例如: tracker_server=192.168.159.140:22122 # 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=E:fdfs_log # 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.159.140:22122 #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 5、文件上传测试导入模块: from fdfs_client.client import Fdfs_client 导入配置文件: 注意:windows环境下绝对路径会发生转义,需要加上 "r" 说明是原生字符串 client = Fdfs_client(r'配置文件绝对路径') 上传图片: 注意:windows环境下绝对路径会发生转义,需要加上 "r" 说明是原生字符串 client.upload_by_filename(r'图片文件绝对路径') 如果你看到如下画面你就成功了!!! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows-server-2008 – 页面文件大小windows 2008 R2
- windows – CFileDialog :: OnInitDialog()不调用
- 如何在Windows上制作相同高度的SWT按钮,文本和标签?
- WaitForSingleObject的详细用法
- win10安装Redis方法以及基本配置
- Windows服务 – 计划任务或Windows服务
- 如何在Windows 10上使用64位mongodb进行流星工作?
- windows-phone-7 – 如何在Windows Phone 7中获取Wi-Fi和移
- active-directory – 将新服务器添加到服务器管理器,获取Ke
- 最小的Windows 2008或2012内存使用量
- DLL – 在Firefox扩展中使用Firebreath生成的插件
- windows-xp – 如何编写schtasks脚本以便它不需要
- 在Windows上使用OpenGL扩展
- 逆向工程 – 在拆卸dll时,IDA比visual studio有什
- Windows Server 2016-管理站点复制(一)
- .net – 如何使用Mono.Cecil检查.pdb和.dll文件是
- windows – 从vim会话中删除缓冲区
- Windows 2008 R2 开启磁盘清理的方法
- windows-server-2008 – 机器启动组策略是如何处
- Windows Server 2016-命令行方式管理Windows服务