Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

starlette-async-jinja

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

starlette-async-jinja

  • 1.8.0
  • PyPI
  • Socket score

Maintainers
1

starlette-async-jinja

Code style: crackerjack

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc