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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef6d5fbe95e4b01f280e0f1c4c1262b8383b5b167db5925834b240e4385bfe58 |
|
MD5 | 727dad56ef0162a8f5fab420a6148380 |
|
BLAKE2b-256 | d809d165dd14b48bc35a6c2f1c7ccf619521ff529f1db811992664e87aae65d8 |
Close
Hashes for starlette_async_jinja-1.7.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d3f3948ffd399b0f338b0421f5581270f6495b5d9c176c8b00e88fbdf55f5b2 |
|
MD5 | 04e8fe4f70c52e01e3ad50ac583b3efd |
|
BLAKE2b-256 | aa45cb9a12a085bc3569d03d42f986c583cda85f9942f90924b572446e6d3a5a |