Install using pip , python version is required >=3.9
pip install cgi-serverDownload the source code, you need python version >=3.9. You can download the code from the latest release or download it through git.
git clone [email protected]:0x404/cgi-server.gitAfter the download is completed, enter the file root directory and execute the installation command
python setup.py installAfter installation is successful, it can be used as a Python library
The following example builds a hello world page using this library to quickly create a hello world page
# hello.py
from cgiserver import route , run
@ route ( "/helloworld" , method = "GET" )
def web_page ():
response = "<h1> Hello World </h1>"
return response
if __name__ == "__main__" :
run ( "127.0.0.1" , 8888 )Execute the following command:
python hello.py
You can see a hello world page at http://127.0.0.1:8888/helloworld
For more detailed instructions, please refer to example.py, which introduces the various functions of this library in detail.
In addition, you can refer to this repository. In this repository, a web application is built using this framework, supporting static pages, Ajax requests and other functions.
Use the following command to complete uninstall
pip uninstall cgi-serverHTTP parsingHTTP ServerCGI routingFor detailed requirements, please see CONTTRIBUTING.md