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.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-4.1.0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareASGI_static-4.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / bareASGI-static-4.1.0.tar.gz
| Download URL | bareASGI-static-4.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
796028259f4e741797f1255733b56c8d263a027b5228b3e3e8a2d57b0db35ae4
|
|
BLAKE2b-256 checksum How to use checksums |
11c7dafed53018b9b42cdb698751aaa474c309089fa7201fffcc4550f2a9ace0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
|
Release files / bareASGI_static-4.1.0-py3-none-any.whl
| Download URL | bareASGI_static-4.1.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d009b5986acc9f1044f2bf7a0148e84576ab22d5dcc715f991895cf4b409a08
|
|
BLAKE2b-256 checksum How to use checksums |
b861b1e69078da437bc08cb238209a261e439a0de33a9b41f61d794ac4d8b042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
|