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')
Even simpler (and more Flask like):
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.6.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f80ad1f30d778b48563a6bf659aca973ac2424dd92ea5653bbc065702e5830e0 |
|
MD5 | 566f2d916f62f9051f9b27cd9fdf1a10 |
|
BLAKE2b-256 | 46d9c25da16d207a079e3c855fee84bc0ad92fa6f238e2bbd8cc0bd5cdb4eff7 |
Close
Hashes for starlette_async_jinja-1.6.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42f2a11082b949122fb1109205c35bf5992d730d5b1ab70ab285e73f3763bcfe |
|
MD5 | 8a63c182cd779c3bc31341601ed17a68 |
|
BLAKE2b-256 | 44d34207e7c9255979e1da62677b98d0b8a4bfed9b3dadaca11fd929437a0091 |