Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Python 3 equivalent of "python -m SimpleHTTPServer"

What is the Python 3 equivalent of python -m SimpleHTTPServer?

like image 730
ryanbraganza Avatar asked Oct 30 '11 07:10

ryanbraganza


People also ask

What is SimpleHTTPServer python?

SimpleHTTPServer is a python module which allows you to instantly create a web server or serve your files in a snap. Main advantage of python's SimpleHTTPServer is you don't need to install anything since you have python interpreter installed.

What does python3 HTTP server do?

The server provides a simple directory UI to access any of the files. This is the simplest way to serve files locally over HTTP directly. Python provides us with the SimpleHTTPServer module (or http. server in Python 3) that can quickly and efficiently serve files from a local directory via HTTP.


1 Answers

From the docs:

The SimpleHTTPServer module has been merged into http.server in Python 3.0. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.

So, your command is python -m http.server, or depending on your installation, it can be:

python3 -m http.server 
like image 183
Petr Viktorin Avatar answered Oct 12 '22 10:10

Petr Viktorin