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
File details
Details for the file starlette_async_jinja-1.8.0.tar.gz
.
File metadata
- Download URL: starlette_async_jinja-1.8.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.0.post1 CPython/3.13.0 Darwin/24.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01e2a8093e74b136ccaebc54940f4ccfd5ac83ddfcaf2ab4acdbf66a6eb5f1ea |
|
MD5 | b357b35584d0e51799aae9dcf11d55cd |
|
BLAKE2b-256 | ea52199a104e8a535db3a1bff84f8e37f50fe078cd5ad2f54c2f8531b516f8d3 |
File details
Details for the file starlette_async_jinja-1.8.0-py3-none-any.whl
.
File metadata
- Download URL: starlette_async_jinja-1.8.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.20.0.post1 CPython/3.13.0 Darwin/24.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6b9e6bbcc320fcad7b448396e0ce6c29a347c00bfd7fbb70955298b3725204b |
|
MD5 | d82b2d5522a2a98c5edcdb02e370dd3a |
|
BLAKE2b-256 | 2553fdb78c488728e3ca181474baa57b37f3a6343918562b8a31d9043a7f1eb8 |