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 3.0.3
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-3.0.3.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareASGI_static-3.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.1 kB
Release files / bareASGI-static-3.0.3.tar.gz
| Download URL | bareASGI-static-3.0.3.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fd0ee6ba5c2f67a6fd6ddcebb62beb7284638cc6fa53b6c30ea7005440a9f8f
|
|
BLAKE2b-256 checksum How to use checksums |
8b1434a8059a579396f3409123b5a0dff6122bf5dfedd99ad9e6d91b0e9a56d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.1 CPython/3.8.5 Linux/5.8.0-50-generic
|
Release files / bareASGI_static-3.0.3-py3-none-any.whl
| Download URL | bareASGI_static-3.0.3-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fdcf786f85e484511bde6db32472772ef52fe12b726c08defc3cf086d824fb1
|
|
BLAKE2b-256 checksum How to use checksums |
194eec75993bc9056de3b3c60d75ab1729e77768e777251156bf678940599ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.1 CPython/3.8.5 Linux/5.8.0-50-generic
|