Skip to main content

bareasgi-static

Static file support for bareASGI (read the documentation)

Overview

This package provides support for serving static files to bareasgi.

Usage

The following example serves a single file.

import uvicorn
import os.path
from bareasgi import Application
from bareasgi_static import file_response

here = os.path.abspath(os.path.dirname(__file__))

async def http_request_callback(request):
    return await file_response(request, 200, os.path.join(here, 'file_stream.html'))

app = Application()
app.http_router.add({'GET'}, '/example1', http_request_callback)

uvicorn.run(app, port=9010)

The next example serves files below a given directory.

import os.path
import uvicorn
from bareasgi import Application
from bareasgi_static import add_static_file_provider

here = os.path.abspath(os.path.dirname(__file__))

app = Application()
add_static_file_provider(app, os.path.join(here, simple_www), index_filename='index.html')

uvicorn.run(app, port=9010)

Release files for bareASGI-static 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bareASGI-static 4.0.0
File Size Uploaded
bareASGI-static-4.0.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bareASGI-static 4.0.0
File Interpreter ABI Platform
bareASGI_static-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.2 kB

Release files / bareASGI-static-4.0.0.tar.gz

Download URL bareASGI-static-4.0.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3256414d8f2687f6ab2ae1694968e19448b8b1be4cd886d22c1404957e43392d
BLAKE2b-256 checksum
How to use checksums
1dc3c6781ddba93e7418d462d7c3ffb3e4d9dca419f800aa853ef950ebba40f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Darwin/19.6.0

Release files / bareASGI_static-4.0.0-py3-none-any.whl

Download URL bareASGI_static-4.0.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adade799269ce8d5833fc168e3c5323f2a6f0304da142b5e0f304fbd8ee8f708
BLAKE2b-256 checksum
How to use checksums
64ce0f605e7abc0580924d8ba22abd84a0430b1d4dda979362ea3fc31770aa00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Darwin/19.6.0

Release history Release notifications | RSS feed

5.0.0

2 release files

4.1.0

2 release files

This release

4.0.0 This release

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page