美文网首页
Python:简易文件存储服务器

Python:简易文件存储服务器

作者: LightingContour | 来源:发表于2019-11-05 11:10 被阅读0次

Python内置了简易服务器,可作为简易的FTP使用。

使用方法(Mac):
1.使用terminal或iTerm等,打开需要文件共享的文件夹。
2.1若使用Python2.7(Mac内置版本)
python -m SimpleHTTPServer 端口号建议为python -m SimpleHTTPServer 8002
2.2若使用Python3.7
python3.7 -m http.server 端口号建议为python3.7 -m http.server 8002
3.通过浏览器登录localhost:端口号或本机ip:端口号,即可登录服务器
(本机ip可通过ifconfig en0查询)

示例.png

官方文档:
Python2.7 SimpleHTTPServer:
https://docs.python.org/2/library/simplehttpserver.html
Python3.7 http.server
https://docs.python.org/zh-cn/3.7/library/http.server.html?highlight=http%20server#module-http.server

相关文章

网友评论

      本文标题:Python:简易文件存储服务器

      本文链接:https://www.haomeiwen.com/subject/hndsbctx.html