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.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b3f6c78bc8c3662ce91b4659094187db528d0c1e9fc3a87e312ca88bd38eb0c |
|
MD5 | 39fae87a3831432dde8f607d2a5df743 |
|
BLAKE2b-256 | 40a403330a1803ac09c27fef7a469525b9cade8568247b1ea5f859862e62ee3a |
Close
Hashes for starlette_async_jinja-1.7.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e7a91cd146868db82a8137d538d3cc01af31f7cdaffc535204e61ddbc7ca5ed |
|
MD5 | 6f73a98f2e9595b24da95cce4acfe2ec |
|
BLAKE2b-256 | 2c79b81a5e893aabdac817d730462ecfdd46ed9bbadf48ed16d65c9fb8e33070 |