Skip to main content

bobtail-jinja2

Bobtail middleware for Jinja2 templating

Install

pip install bobtail-jinja2

Usage

from bobtail_jinja2 import BobtailJinja2, Response

app = Bobtail(routes=routes)

app.use(BobtailJinja2(template_dir="templates"))

Render the template in a Bobtail handler. BobtailJinja2 provides a Bobtail handler Response type that also include the Jinja2 template attribute for IntelliSense etc.

from bobtail import AbstractRoute, Request
from bobtail_jinja2 import BobtailJinja2, Response
class HomeRoute(AbstractRoute):

    def get(self, req: Request, res: Response) -> None:
        res.set_headers({
            "Content-Type": "text/plain",
        })
        res.jinja2.render(res, "routes/home.jinja2", data={"title": "Welcome to Lanka Note"})

Metadata

Release files for bobtail-jinja2 0.0.2

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

Source distribution (sdist)

Source distribution for bobtail-jinja2 0.0.2
File Size Uploaded
bobtail_jinja2-0.0.2.tar.gz 3.0 kB Details

Release files / bobtail_jinja2-0.0.2.tar.gz

Download URL bobtail_jinja2-0.0.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fa1726016be5051e779c74a5e24f562be4504679583f4b526e31de3b87750516
BLAKE2b-256 checksum
How to use checksums
e9ef566b6a73720b0f0ebdc709aa0ea88696766600e1c1c5dc1ec441741fc141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

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