Skip to main content

A lightweight and flexible webserver.

Project description

MicroServer

MicroServer is a lightweight Python webserver with minimal overhead and no external dependencies MicroServer provides complete flexibility by leaving all data processing and templating to the user.

from microserver import MicroServer, Response

server = MicroServer()

# Configures the route / to be handled by the home function.
@server.route('/')
def home():
    data = server.load_view('index.html')
    mime = 'text/html'
    return Response(data, mime)

# Configures all 404 errors to be handled by the e404 function.
@server.errorhandler(404)
def e404():
    data = server.load_view('404.html')
    mime = 'text/html'
    return Response(data, mime)

# Starts the server on the given host and port.
server.start('localhost', 8080)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BLM16-MicroServer-1.0.0.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

BLM16_MicroServer-1.0.0-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page