Skip to main content
# bareasgi-static

Static file support for bareasgi

## Overview

This package provides support for serving static files to bareasgi.

## Usage

The following example serves a single file.

```python
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.

```python
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 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bareASGI-static 0.1.0
File Size Uploaded
bareasgi_static-0.1.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bareASGI-static 0.1.0
File Interpreter ABI Platform
bareasgi_static-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / bareasgi_static-0.1.0.tar.gz

Download URL bareasgi_static-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f956ce433ee578bae498e10e7027d8dca3f4d8ff0f3aae0bb792c21a749ac49e
BLAKE2b-256 checksum
How to use checksums
1abeaf5cf238b91feadd78824060a8bb456a7eda01594cce38907d2a725ae2b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1

Release files / bareasgi_static-0.1.0-py3-none-any.whl

Download URL bareasgi_static-0.1.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a3cacdae9e8b5fcf16a617b46dc4f6559313e37aa642365c6c24f4be4f62646
BLAKE2b-256 checksum
How to use checksums
e9019041696f2bbd2befa7bce3c032bb943501d57bffe04745adc6f7638b2af0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1

Release history Release notifications | RSS feed

5.0.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page