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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
j2htmx-0.1.0-py3-none-any.whl
(8.2 kB
view hashes)