Skip to main content

Basic static file serving middleware for WSGI

Project description

Basic static file serving middleware for WSGI.

Usage

import os
from wsgiref.simple_server import make_server
from wsgi_static_middleware import StaticMiddleware

BASE_DIR = os.path.dirname(__name__)
STATIC_DIRS = [os.path.join(BASE_DIR, 'static')]


def app(env, start_response):
    start_response('200 OK', [('Conte-type', 'text/plain; charset=utf-8')])
    return [b'Hello World']

app = StaticMiddleware(app, static_root='static', static_dirs=STATIC_DIRS)

if __name__ == '__main__':
    httpd = make_server('', 8000, app)
    httpd.serve_forever()

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

wsgi-static-middleware-0.0.1.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

wsgi_static_middleware-0.0.1-py3-none-any.whl (4.2 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