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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c01935b1d4053213994230da8983b93a1d08639f9aec18cb0539e6ce010fd79 |
|
MD5 | 2ab4c26017d11faa4db13c5b4e46330b |
|
BLAKE2b-256 | 547a64c759fb274bf1a3a1c03f5f3822126af82534e56d1c518ed6e5352b8d2a |
Close
Hashes for starlette_async_jinja-1.7.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d900c0f5cda01afb08b4a7c128afc3142607636162a28f0564010a7180d807d |
|
MD5 | bc85db9850b3a1e2dd3efb2e439bd571 |
|
BLAKE2b-256 | 0a1edabd71ab5b00564e5508d3af1d3b5504bf1040bf3ef84f9364b672e332b5 |