Skip to main content

bareASGI-jinja2

Jinja2 support for bareASGI (read the documentation)

Usage

Try the following.

from typing import Mapping, Any
import jinja2
import os.path
import uvicorn
from bareasgi import Application
from bareasgi_jinja2 import Jinja2TemplateProvider, add_jinja2

here = os.path.abspath(os.path.dirname(__file__))

async def http_request_handler(request: HttpRequest) -> HttpResponse:
    """Handle the request"""
    template = 'example1.html'
    variables = {'name': 'rob'}
    return await Jinja2TemplateProvider.apply(request, template, variables)

app = Application()

env = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.join(here, 'templates')),
    autoescape=jinja2.select_autoescape(['html', 'xml']),
    enable_async=True
)

add_jinja2(app, env)

app.http_router.add({'GET'}, '/example1', http_request_handler)

uvicorn.run(app, port=9010)

Metadata

Release files for bareASGI-jinja2 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bareASGI-jinja2 5.0.0
File Size Uploaded Provenance Actions
bareasgi_jinja2-5.0.0.tar.gz 8.0 kB Without provenance Details for bareasgi_jinja2-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bareASGI-jinja2 5.0.0
File Interpreter ABI Platform Actions
bareasgi_jinja2-5.0.0-py3-none-any.whl Python 3 none any Details for bareasgi_jinja2-5.0.0-py3-none-any.whl

Total release size: 16.1 kB

Release files / bareasgi_jinja2-5.0.0.tar.gz

Download URL bareasgi_jinja2-5.0.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
264816cf4b6f6029ed9be6b0fe7e404d2397854a84b50d3146d563266d8898be
BLAKE2b-256 checksum
How to use checksums
39f6e97f6fadd3c5726ea2bbacfe568610719a4812ffae181f21a219dd634761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / bareasgi_jinja2-5.0.0-py3-none-any.whl

Download URL bareasgi_jinja2-5.0.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c8c2f211fa87775392de38a50b1315fd88bed5348f0e7e21e8b903dcdb6d914
BLAKE2b-256 checksum
How to use checksums
534398ff55dc1294f3702f28dcde179074e1d9afb8c95388e345408012868e54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for bareASGI-jinja2 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page