This article mainly introduces the simple building of Python3 with the server, has a certain reference value, and now share to everyone, the need for friends can refer to
Web development, we start by building a simple server, Python comes with a service module, and Python3 compared to Python2 is very different,
In the Python2.6 version, the/usr/bin/lib/python2.6/directory will have basehttpserver.py, simplehttpserver.py, cgihttpserver.py two files,
But in the Python3.4, there is no above 3 files, but close to the/usr/bin/python3.4/http/server.py file.
So in the Python2 version, if you want to start a Python-brought service, enter it in the Doc window:
Python-m Cgihttpserver 8081
where 8081 port number can be set by itself, the default port number is 8080
And in Python3, because the
basehttpserver.py, simplehttpserver.py, cgihttpserver.py modules are merged for the server module, so the code to start the server has also changed to:
<strong>python-m Http.server 8081</strong>
After starting correctly, the following:
Enter localhost: port number in the browser to access