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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab395367ccd54892827a79e8330d4689553834e0732e036dff03d6914209e66 |
|
MD5 | 2350664fe44983ba7531a8d6ac1fbab6 |
|
BLAKE2b-256 | 15cdbe4b0fc930f32cd290915024207a5e0a8d6377f66c6288344e3b2792a0f5 |
Close
Hashes for starlette_async_jinja-1.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a80c6cc4a5027d705dac0ab5877ae2ae70ad41db97c6c314a96dccf177086c2 |
|
MD5 | 253d16ac0c13ab8d085472c7ddf3db33 |
|
BLAKE2b-256 | e89cd980c5f0a512cffa67e69026d6f058332fcc3697f6e56cf3b1e810c57a2a |