ASGI Middleware for serving Static File.
Low maintenance activity. Last release 11 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
Consider insteadservestaticPythie’s Index: 78237.9K downloads/moCompare →
pip install asgimiddlewarestaticfileASGIMiddlewareStaticFile
ASGI Middleware for serving static file.
Why?
ASGIMiddlewareStaticFile is a solution when we need to distribute the whole project with static files in Docker; or when the deployment environment has very limited resources; or Internal network(Unable to reach CDN).
Features
- Standard ASGI middleware implement
- Async file IO
- Support ETag, base on md5(file_size + last_modified)
Install
pip3 install -U ASGIMiddlewareStaticFile
Usage
Common
Prepare
pip3 install -U ASGIMiddlewareStaticFile
git clone https://github.com/rexzhang/asgi-middleware-static-file.git
cd asgi-middleware-static-file/example
Test with wget
(venv) ➜ example git:(main) ✗ wget http://127.0.0.1:8000/static/DEMO
--2022-02-10 16:02:07-- http://127.0.0.1:8000/static/DEMO
正在连接 127.0.0.1:8000... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:26 []
正在保存至: “DEMO”
DEMO 100%[===========================================================================>] 26 --.-KB/s 用时 0s
2022-02-10 16:02:08 (529 KB/s) - 已保存 “DEMO” [26/26])