用Python创建一个http服务器 [英] Making a http server in Python

查看:188
本文介绍了用Python创建一个http服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚制作了一个只处理文件上传的http服务器。
想要在http客户端的Get请求中向共享文件的http服务器添加一项功能。

Just made a http server handling only file uploading. Want to add a feature to the http server sharing the file on Get request by a http client.

我不知道如何向客户端显示该文件。所以客户可以使用 http://127.0.0.1/filename.avi

I have no idea how to show the file to clients. So a client can see it using http://127.0.0.1/filename.avi

总结

http客户端正在将文件上传到http服务器。

A http client is uploading a file to a http server.

http客户端通过http服务器观看文件

A http client is watching the file through the http server

推荐答案

Python 2:
SimpleHTTPServer

Python 2: SimpleHTTPServer.

python2 -m SimpleHTTPServer 80

Python 3:
http.server

Python 3: http.server.

python -m http.server 80

这篇关于用Python创建一个http服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆