No project description provided
Project description
starlette-async-jinja
Jinja2 is_async template support for Starlette +
About
- Provides AsyncJinja2Templates class which enables use of the is_async Jinja environment flag with Startlette and Starlette based applications like FastAPI
- Integrated Jinja Partials and Jinja Fragments
- Supports asynchronous template loaders (examples here)
Issues
-
Only asynchronous template loaders (not yet tested but should work) are currently supported
-
The Jinja bytecodecache requires an asynchronous Redis backend
Usage
Import AsyncJinja2Templates:
from starlette_async_jinja import AsyncJinja2Templates
Replace Jinja2Templates with AsyncJinja2Templates:
templates = AsyncJinja2Templates(directory='templates')
Render the async template in the response:
async def homepage(request: Request):
return await templates.TemplateResponse(request, 'index.html')
or:
async def homepage(request: Request):
return await templates.render_template(request, 'index.html')
Acknowledgements
License
BSD-3-Clause
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for starlette_async_jinja-1.7.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e13d0da02f17e69dd1cec6cc92d4c6635f550d8d5f85d87ecc645bfefa79a380 |
|
MD5 | 4ebe5bb04e5b053e4d638be34c9be95c |
|
BLAKE2b-256 | 9b89670a436473fa0ba9992c49e4697e64e607533133c0bf9ba10e57cd166192 |
Close
Hashes for starlette_async_jinja-1.7.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0fe3133e12b72570c136cf1ea97e978ca94ba527ed256e422c7912f4e134913 |
|
MD5 | a4179203f5585a23f9a7292af845b6ed |
|
BLAKE2b-256 | 38a095b486ba88daedea9e7f203cda8b3070d1bb4ba07e85beb6efad5b7c591a |