Home  >  Article  >  Backend Development  >  Python's one-click method to build an HTTP server

Python's one-click method to build an HTTP server

不言
不言Original
2018-06-02 14:21:042138browse

This article mainly introduces the method of using Python to build an Http server with one click. It has certain reference value. Now I share it with you. Friends in need can refer to it.

Today a friend asked me how to start from Download the file on the Alibaba Cloud server. When I heard it, I thought there were many ways. I could just set up a server and drop the file to download it; I could also use FTP; I could just use remote desktop to drag it down.

Considering the convenience, I feel that the above methods are more troublesome, and it is best to have a direct solution to the problem. Then I found it in Python.

Please see Python3

python -m http.server 8000

Please see Python2

python -m SimpleHTTPServer 8000

In short, a Python command can set up an Http server in the current directory, and then you can download the file. Well, Python is the best language in the world.

The effect is as shown in the picture:

##Related recommendations:

How to build the simplest web server using python

The above is the detailed content of Python's one-click method to build an HTTP server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn