-- Leo's gemini proxy

-- Connecting to jan.bio:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Expose a directory on a local webserver with Python 3


Sometimes I want to view some html files from my file system in the browser. With Python 2, you could use the SimpleHTTP-module to start a web server with the current directory as document root like so:


$ ls .
foo.html
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

On my new Linux installation

Manjaro linux

the Python defaults to Python 3. Today I learned how to start a web server with Python 3:


$ ls .
foo.html
$ python -m http.server 8080
Serving HTTP on 0.0.0.0 port 8080 (http://0.0.0.0:8080/) ...

The port number is optional. Open `http://localhost:8080/foo.html` in your web browser to view `foo.html`.

-- Response ended

-- Page fetched on Sat May 4 18:53:09 2024