Skip to content

Instantly share code, notes, and snippets.

@kaniket7209
Created December 1, 2021 08:59
Show Gist options
  • Save kaniket7209/8d258689d94b5bd129146dc418dc430e to your computer and use it in GitHub Desktop.
Save kaniket7209/8d258689d94b5bd129146dc418dc430e to your computer and use it in GitHub Desktop.
1. Is Jinja only for HTML?
Answer: Additionally Jinja is a general purpose template engine and not only used for HTML/XML generation. For example you may generate LaTeX, emails, CSS, JavaScript, or configuration files.
2. Why Jinja2 is useful ?
Answer: Jinja2 is useful because it has consistent template tag syntax and the project is cleanly extracted as an independent open source project so it can be used as a dependency by other code libraries.
3. Why is Jinja used?
Answer: It is used to generate any markup as well as source code. The Jinja template engine allows customization of tags, filters, tests, and globals.Jinja allows the template designer to call functions with arguments on objects.
4. Does flask use Jinja?
Answer: Flask leverages Jinja2 as its template engine. You are obviously free to use a different template engine, but you still have to install Jinja2 to run Flask itself.
5. What is Jinja in flask?
Answer: Jinja2 is a template engine written in pure Python. It provides a Django-inspired non-XML syntax but supports inline expressions and an optional sandboxed environment. ... Flask is a Python-based micro web framework which allows you to write your web applications quickly and efficiently.
6. Does Django use Jinja?
Answer: Jinja is officially supported by Django, and even before that there were third-party packages that allowed you to use it. The only real compatibility issue is that you can't use Django's custom template tags in a Jinja template.
1. Do we have to restart an app if we made any changes to data in a template?
a) Yes
b) No
Answer: b) No
2. Do we have to restart an app if we made any changes with template ?
a) yes
b) no
Answer: a) yes
3. Unlike render_template here also is it neccessary to put the html file inside templates folder?
a) Yes
b) No
Answer: a) Yes
4. DO we need to import jinja2 to use its feauture?
a) Yes
b) NO
Answer: a) Yes
5. What is the correct syntax of impporting jinja2?
a) from jinja2 import Template
b) from jinja2 import jinja2_Template
c) from flask import jinja2_template
d) from jinja2 import template
Answer: a) from jinja2 import Template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment