Back to Examples Run Example

examples/page_with_template.py

from py4web import action


@action("page_with_template")
@action.uses("examples/page_with_template.html")
def page_with_template():
    return {"message": "Hello World"}

templates/examples/page_with_template.html

[[extend 'layout.html']]

<center>
  <h1 class="title">[[=message]]</h1>
</center>