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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a97c3b78bbcb40a84b1b871105301cc5b699f5d8bbce1fbe5280573824764225 |
|
MD5 | 892d9418813232e1ab896c96735d122a |
|
BLAKE2b-256 | 70bdf66c62d5a3ac05cb7fb9056b1591a670f552056129809756410f86d0a8f0 |
Close
Hashes for starlette_async_jinja-1.7.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 846cb39ad6aa53c3631205cccb909d4a8b992ddc9ee1eff040f170afc7ce1328 |
|
MD5 | ffe7752a9c543c8cddf5fc346d5e2d20 |
|
BLAKE2b-256 | 2e965f5c28925af3369953a2b55865b8bcd806fc48b9855de015f2280ea597a0 |