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
bareasgi_jinja2-5.0.0.tar.gz 8.0 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.2.0

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

2 release files

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