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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d130dcd5ce7965e57448bf13e8be8e7aa3781004fbea11332b4993b6096ff886 |
|
MD5 | 403004087d2ba1c0e91ede08b2b9ec32 |
|
BLAKE2b-256 | a4c37f8b82dd6d2e2f4c164b3d5ca8503fa7e99de62d1e32cb6d8527da3e19c4 |
Close
Hashes for starlette_async_jinja-1.7.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 396bcd5c0e04d8e00860c747b97da83c99d51ab7c1d6a30a9fe4421c9774098c |
|
MD5 | 387900f523ef9a3955eeaa9a84ab18b5 |
|
BLAKE2b-256 | 03ab360c2d98bd88d63899f4d3272801815b15a9b2b34c46f75491afdf8fb2ce |