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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29dba1c7078d72c13ef9435327495f3c1fc0cea1fd896b154cb4bddd5c6af23c |
|
MD5 | 29ace7d0c98c0eb56743b643860307a7 |
|
BLAKE2b-256 | b8a26df89e1ddd1eb8cd6aa5d09412ac32d0539b827ddad5d270452674d02b9e |
Close
Hashes for starlette_async_jinja-1.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8888ff0e7e67c00a1dc1fb51ef0d653bc3da8f96f47ed2d9ad86ca4896004c51 |
|
MD5 | e7dbc5c47b0f4ceb8d0a5ae23da23947 |
|
BLAKE2b-256 | 3ec75898e711fda9e96a45c7342e2be3defdedf9f74723671e0535f5a1baa8e8 |