tutorials python

Quickly serve a folder via Web Server

A short one liner to quickly serve any folder via a http server.

Start the server

cd to the directory you want to serve.

Python 2.7

At the shell prompt enter python -m SimpleHTTPServer

Python 3

At the shell prompt enter python -m http.server

Access the files from your browser

When run the command will output the port which the server is available on.

You can optionally provide a port number e.g. python -m SimpleHTTPServer 8080 to set this yourself. You can only serve a single folder at each port.

Open your web browser and access http://localhost:PORT/

If you set the port number yourself access via http://localhost:8080 changing 8080 to the port number you picked.

Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt6
More info Get the book

Downloadable ebook (PDF, ePub) & Complete Source code

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount on all books and courses.

[[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount on all books and courses.