Home > Mobile >  Python 3 Server command update
Python 3 Server command update

Time:10-02

I am new to Python so i wanted to ask you for help.

In old versions of Python to create a server which would not store any logs and its standard output was redirected to dev/null to avoid saving information, we executed the following instruction:

nohup python -m SimpleHTTPServer 80 > /dev/null 2>&1 &

> /dev/null: Indicates that standard output is directed to /dev/null

2>&1: It indicates that all the errors that occur will not be stored in the log since they will be redirected to the standard output which we have redirected to /dev/null.

&: Indicates that this task will run in the background.

However, I don't know how to do it in the newer versions of Python, can you help me?

Tks guys.

CodePudding user response:

The SimpleHTTPServer module has been merged into http.server in Python >= 3.0. Try this one:

python -m http.server
  • Related