Pre-release
This release is a pre-release and may not be stable for production use.
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 4.0.0a0
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-4.0.0a0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareASGI_static-4.0.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / bareASGI-static-4.0.0a0.tar.gz
| Download URL | bareASGI-static-4.0.0a0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60b32efe5d332c10361b4c074706408ef675a15f785daf08b808f1f8a4100ce0
|
|
BLAKE2b-256 checksum How to use checksums |
b545b5f0c82b03af4a287318948bad061d11f90b9ce66e52106b9237c521de0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
|
Release files / bareASGI_static-4.0.0a0-py3-none-any.whl
| Download URL | bareASGI_static-4.0.0a0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2956e21278f1ecef613de9bc1c46f1a48f286b20df71ebd746beb4a9da5f0f7e
|
|
BLAKE2b-256 checksum How to use checksums |
4c182305118535a347107624b3ec3ea6ec20c699af8504273c7886f5376749b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
|