Really simple HTTP server in Python


To get a really quick and simple HTTP server up and running in Python...

import os
from http.server import HTTPServer, SimpleHTTPRequestHandler

# Ensure the server web root is the current directory
os.chdir('.')

# Create server object listening on port 80
server_object = HTTPServer(server_address=('', 80), RequestHandlerClass=SimpleHTTPRequestHandler)

# Start the web server
server_object.serve_forever()

print('The web server is now running...')

Related Articles

How to mount to a CIFS based network share from a Raspberry PI.

Raspberry PI, Linux, Networking

How to install and setup an OS on a Raspberry PI headlessly.

Raspberry PI

Commands to update and upgrade a Raspberry PI

Raspberry PI

Purchased one of these HATs recently? How to change the fan speed at different temperatures.

Raspberry PI