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.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d239a2dee64c3dad8ef5cf1fc2c518a53eb9352e763d0cf059ba4ed33e3fc7fb |
|
MD5 | fa0ee6d4185e37626cdc43e27c8497a7 |
|
BLAKE2b-256 | d36bf83df273bfe6bb86ff2ad8eac272a76a285c94f6e335a7d36a5ae3b4d4f0 |
Close
Hashes for starlette_async_jinja-1.7.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 005b93fdd92febe32bf2079f317a4c1f351f7904d69003d608614fd5513245ec |
|
MD5 | eed5b109257f07eea4ac4bc63837c848 |
|
BLAKE2b-256 | 2d5dd8e52767f23f14950fba775cc9754f236611e98efcbb8856cf4f4a7918b7 |