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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a39ed9d2828388c4aff862de52c82953c94ffe54c4309cc7f3e8d6732ed9a11e |
|
MD5 | 931d0ca8b63cba9c51fb5583b923cbd1 |
|
BLAKE2b-256 | 7df4a3b79fcae19b9b0e00657863b6d7337a9e829b3c5221402e86c3839ea555 |
Close
Hashes for starlette_async_jinja-1.7.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c30227e8e5f357eb635b4025527ca21c6d5fbc230e765ba1261324a2bf662232 |
|
MD5 | e2243cef12119ac36574517dae61d81c |
|
BLAKE2b-256 | 738bd241186991cb1e916833f7d76b85402d1a23ce550cf8bf00849da91e11f0 |