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(scope, info, matches, content):
return await file_response(scope, 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 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bareasgi_static-1.1.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareasgi_static-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / bareasgi_static-1.1.0.tar.gz
| Download URL | bareasgi_static-1.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30b99792dfe85e89d4b76ce859d272075fc3005da3991f80ea29ae44ed843d7f
|
|
BLAKE2b-256 checksum How to use checksums |
2346ae47f8ce4c9657f3d1b1123eccca83d62fa04902fc45cfae6ac351c36356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / bareasgi_static-1.1.0-py3-none-any.whl
| Download URL | bareasgi_static-1.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5792d5c2a90a6d5c4b2786a00c7f25fc182c43f8b285ca4677e6b649180d9df4
|
|
BLAKE2b-256 checksum How to use checksums |
8563b1620db7d654a2914c68c2e1dca9bdb1f9b0b6333aa9bc1a8e820ecade14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|