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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c699b79a62a27c749bb08af204d8e1c9173e1d1de7f281cb1ce30ea33d1916d |
|
MD5 | 61e10523a3eafcb7918c7fa18a122cc2 |
|
BLAKE2b-256 | 49ee672095329e6aaabbee820a2a89ffd79dce1186012913d07802290117c3b2 |
Close
Hashes for starlette_async_jinja-1.7.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5907f6b1bb4349c53a299a95dbf4cb0451a136cbaaef596547025e1d819234 |
|
MD5 | 6fabade1515dbb58b2de13a28a3960b4 |
|
BLAKE2b-256 | 0787ca58ac2c4c49d7ad8e74a10e4ef39bfc08e0e059cabdd39bf0908eb8b98a |