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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e985a84af7bc0a80d26d3066c8a62c89a7c2997c40763cab080dbf37c656d1e |
|
MD5 | 9b07d77d5ede682d342b2d1756938bde |
|
BLAKE2b-256 | 79e6193d8f3e95455417cc1e99ad7e17fe9ef5d71b87ed53ca77ab50ec88daf8 |
Close
Hashes for starlette_async_jinja-1.7.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bd64320fd1b08342214e547911ab67aac091576beb86bb9415b3bdffcbf6345 |
|
MD5 | 23ef7c8cc523c42b2012232b2d298bf8 |
|
BLAKE2b-256 | e1a2e3bdbf9d012633d699f273eaa9ba49843912f2ed5dbcea17f2448174e371 |