Python – easy local server startup
The easiest local server launch for python without frameworks.
Installing Python
First of all python must be installed. Let’s do it for Mac OS via Homebrew:
Running a server in python
To avoid the error, there must be a cgi-bin directory, otherwise:
code 403, message CGI script is not a plain file (‘/ cgi-bin /’)
Inside the project python create a directory:
And inside it is a new file, to which we will assign rights:
Content of this file:
#! / usr / bin / env python3
import cgi
import html
print(“Content-type: text / html”)
print(“
Hello!
“)
We start the server:
python3 -m http.server –cgi
The server will run at: