The purpose
You can set up a Web Server in Python without writing a single line of code.
I’ll explain why later, but please use this only in secure environments, such as within a LAN.
How to start
Download and install Python from the following page.

To run a server, you need to launch a command prompt, navigate to the folder you want to be the server’s root directory, and then execute the following command.
python -m http.server
With the above steps, the HTTP server has now been started.
You can access the running server from a browser by going to http://localhost:8000/
or http://[ip-address]:8000
.
What a running web server can and cannot do
To summarize what a running web server can and cannot do.
What a running web server can do
List of Files and Downloads
When you run the server startup command and there is no index.html (or index.htm) file in that folder, accessing “http://localhost:8000/” will display a list of the folders and files.
You can navigate folders by clicking on them, and you can download files (or view their content, depending on the file type) by clicking on them.
Of course, you can also access files and folders directly by typing the path into the URL.

Show HTML
When you select an HTML file from the browser, it will be displayed as HTML (although the server is simply returning the HTML file).
Additionally, if an index.html
(or index.htm
) file exists when viewing a folder, that index.html
(or index.htm
) file will be displayed.
Specifying the Port
You can specify the port number after http.server
in the startup command.
Exmpleple:Specify port 8001.
python -m http.server 8001
On Windows, you can also specify port 80.
about CGI
CGI can be used by specifying the --cgi
argument when launching the server. (Note that the language used for CGI is Python.)
However, it has been explicitly stated that CGI will be removed in version 3.15. Considering the future, I personally recommend not using it much.
What a running web server cannot do
Use HTTPS
It seems that it does not support HTTPS. Therefore, please only use it in a secure location, such as within a LAN.
DELETE/PUT
You cannot directly manipulate files on the server using DELETE or PUT methods.
Result
I was able to start a server using Python.
This seems to be a simple system that doesn’t save data or files to the server, making it easy to use in a limited environment such as a local area network (LAN).
Memo
Location of the server (http.server) code
install folder of Python\Lib\http\server.py
Example:
C:\Users\user name\AppData\Local\Programs\Python\Python310\Lib\http
Reference

comment