Jinja 2 Templates
Hello everyone!
Recently, I have been exploring Jinja 2 Templates. I find it interesting so I would like to share whatever I learn as articles on LinkedIn . This will help enthusiasts to scale up from scratch.
Jinja 2 is a powerful Python template that helps us create dynamic content (i.e.) periodically updated data. For example, data like input from users, some values to be entered, etc. come under dynamic data.
You need not type any manual data like HTML for each dynamic content. It is widely used in frameworks like Flask and Django. Flask is a lightweight API framework and Django is used for larger level projects.
pip install jinja2
This way, we will install Jinja 2. A thing to make a note of is to have extensions like .j2 and .html for all your Jinja files.
Eg:
<h1>Hi, {{ name }}!</h1>
<p>Welcome</p>
The double curly braces indicate where the dynamic content should go. Let us have this file named template.j2.
Recommended by LinkedIn
So, that’s it for the day! Thanks for your time in reading my article. Tell me your feedback or views in the comments section.
Check out this link to know more about me