This article describes how to set up an HTTP server and an FTP server in Python for reference, interested friends can refer to this article for details about how to build an HTTP server and an FTP server in Python, which has some reference value, for more information, see
This tutorial describes how to set up an HTTP server and an FTP server in Python for your reference. The details are as follows:
The default installation version is pytho2.7.
Http server constructionTutorial:
Go to the directory where you want to open the access and run the command: python-m SimpleHTTPServer 9000
If the preceding information is displayed, the installation is successful, and the http service port is 9000. port 80 is not followed by the default port.
Access the http service through a browser:
Http: // localhost: 9000
The page is displayed as follows:
The server displays the following information:
The request is successfully received.
Below isFtp server constructionTutorial:
Python does not have an ftp service library, so you need to install the plug-in:
Go to the Python27 \ scripts directory and run the pip install pyftpdlib command. the following command is displayed, indicating that the installation is successful.
Go to the ftp service directory to be opened and run python-m pyftpdlib-p 21, as shown below, indicating that the ftp service is successfully set up.
Access via ftp: // localhost: 21 in the browser. The following is displayed, indicating that the access is successful:
The server displays the following information, indicating that the request is successfully received:
The above describes how to set up an HTTP server and an FTP server in Python. For more information, see other related articles in the first PHP community!