开发者

Making a http server in Python

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 h开发者_Python百科ttp client.

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

In summary

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

A http client is watching the file through the http server


Python 2: SimpleHTTPServer.

python2 -m SimpleHTTPServer 80

Python 3: http.server.

python -m http.server 80


You can look at Flask. It is very lightweight and probably does most of what you're looking for.


new python would be python -m http.server [port number] in the command prompt


for the local server with python I run

$ python3 -m http.server 8080

inside the folder that contains my index.html. Is there any way (maybe a specific flag) to proxy the requests which can't be resolved locally to a given url?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜