bareasgi-static-4.1.0


توضیحات

Static file support for bareASGI
ویژگی مقدار
سیستم عامل -
نام فایل bareasgi-static-4.1.0
نام bareasgi-static
نسخه کتابخانه 4.1.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Rob Blackbourn
ایمیل نویسنده rob.blackbourn@gmail.com
آدرس صفحه اصلی https://github.com/rob-blackbourn/bareASGI-static
آدرس اینترنتی https://pypi.org/project/bareasgi-static/
مجوز Apache-2.0
# bareasgi-static Static file support for [bareASGI](http://github.com/rob-blackbourn/bareasgi) (read the [documentation](https://rob-blackbourn.github.io/bareASGI-static/)) ## 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(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. ```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) ```


نیازمندی

مقدار نام
>=0.7,<0.8 aiofiles
>=4.0.0,<5.0.0 bareASGI


زبان مورد نیاز

مقدار نام
>=3.8,<4.0 Python


نحوه نصب


نصب پکیج whl bareasgi-static-4.1.0:

    pip install bareasgi-static-4.1.0.whl


نصب پکیج tar.gz bareasgi-static-4.1.0:

    pip install bareasgi-static-4.1.0.tar.gz