Skip to main content

jinja2 template for light-weight htmx page rendering

Project description

Maxwell's demon of test enviroment

page/page.py

from j2htmx import Component


class Page(Component):
    ...

page/i.html

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
</head>
<body id="{{ component }}">
   {{ param_text }}
</body>
</html>

main.py

from aiohttp import web
from aiohttp.web_request import Request

from page.page import Page

routes = web.RouteTableDef()

app = web.Application()


async def root_page(request: Request) -> web.Response:
    return web.Response(text=await Page().finalize(
        param_text='Hi'
    ), headers={'Content-type': 'text/html; charset=utf-8'})


app.add_routes([
    web.get('/', root_page)
])

if __name__ == "__main__":
    web.run_app(app)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

j2htmx-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

j2htmx-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file j2htmx-0.1.0.tar.gz.

File metadata

  • Download URL: j2htmx-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for j2htmx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72b342ea87645dd99108f51875d2cd2365c969e96fd520f44eb09fe3d90d74ff
MD5 dcb812535c5f230d4fb01b39cde94869
BLAKE2b-256 cc068160cc55196eabaec3defed8117b3bf82839f91f360f4788e56d566205c5

See more details on using hashes here.

File details

Details for the file j2htmx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: j2htmx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for j2htmx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 010c88cdebe091bb0c3806933ef8c8019ae96c01a2586f291b061bdb057762fe
MD5 219e1849396119160a5159505b65c4f2
BLAKE2b-256 0e0d8434cdb5128169fb9ca979d0c1bdd0dce1c3e49e2fd0982fa3cfc2faf192

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page