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.2
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.2.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareASGI_static-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / bareASGI-static-3.0.2.tar.gz
| Download URL | bareASGI-static-3.0.2.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bea1d1864695aed1f5696ce8ac8f95faf3e71fd9200f873cf48c88cce50b391
|
|
BLAKE2b-256 checksum How to use checksums |
19f203a63e12e72f9ac9654f0787d54152af419dff4ae428a5b4be90b7a6dd86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.4 CPython/3.8.5 Linux/5.4.0-66-generic
|
Release files / bareASGI_static-3.0.2-py3-none-any.whl
| Download URL | bareASGI_static-3.0.2-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
901c4626cbd9c9dd462e641b6c08b97080a03e8b497f42208f4186c61839341c
|
|
BLAKE2b-256 checksum How to use checksums |
1de52e65c61e76dc5a63cc380ad193aefa4911ad0ae6f4d057b2da64219e3c03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.4 CPython/3.8.5 Linux/5.4.0-66-generic
|