Frappe Framework and HTML

When using the Frappe Framework, you can create dynamic HTML pages by utilizing Jinja templates.

To do this, you should create .py and .html files with the same name in the same directory. The Python file should include the get_context method, while the HTML file should contain the Jinja Template.

Using the get_context method in our Python file, we will pass the variables obtained to the Jinja Template within the HTML file to render the page.

For example:

sample_page.py:

sample_page.html:

As shown in this simple example, we were able to render the variables created in our Python file (sample_page.py) inside our HTML file (sample_page.html).