GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — new jinja2 page · junhojam/fullstackpython.com@9aac43b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • about-author.html
  • all.html
  • api-creation.html
  • api-integration.html
  • application-dependencies.html
  • application-programming-interfaces.html
  • best-python-resources.html
  • best-python-videos.html
  • bottle.html
  • caching.html
  • cascading-style-sheets.html
  • change-log.html
  • code-metrics.html
  • comprehensions.html
  • configuration-management.html
  • continuous-integration.html
  • data.html
  • databases.html
  • debugging.html
  • deployment.html
  • development-environments.html
  • devops.html
  • django.html
  • docker.html
  • emacs.html
  • enterprise-python.html
  • feeds
    • all.atom.xml
  • flask.html
  • future-directions.html
  • generators.html
  • integration-testing.html
  • introduction.html
  • javascript.html
  • jinja2.html
  • learning-programming.html
  • logging.html
  • microservices.html
  • monitoring.html
  • morepath.html
  • no-sql-datastore.html
  • object-relational-mappers-orms.html
  • operating-systems.html
  • other-web-frameworks.html
  • platform-as-a-service.html
  • pyramid.html
  • python-2-or-3.html
  • python-programming-language.html
  • servers.html
  • sitemap.xml
  • source-control.html
  • source
    • content/pages/04-web-development
      • 14-template-engines.markdown
      • 17-jinja2.markdown
    • theme
      • static/img
        • template-logic-spectrum.png
      • templates/choices
        • buttons
          • template-engines.html
        • jinja2.html
        • template-engines.html
  • static-content.html
  • static-site-generator.html
  • task-queues.html
  • template-engines.html
  • testing.html
  • theme/img
    • template-logic-spectrum.png
  • unit-testing.html
  • vim.html
  • web-analytics.html
  • web-application-security.html
  • web-design.html
  • web-development.html
  • web-frameworks.html
  • web-servers.html
  • websockets.html
  • what-full-stack-means.html
  • why-use-python.html
  • wsgi-servers.html

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎about-author.html‎

Copy file name to clipboardExpand all lines: about-author.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
124124
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
125125
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
126126
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
127+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
127128
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
128129
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
129130
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎all.html‎

Copy file name to clipboardExpand all lines: all.html
+61-6Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,8 +3054,8 @@ <h2>Why are template engines important?</h2>
30543054
with the exception of the <code>&lt;meta name="description"...</code> line which provides
30553055
a unique short description of what the individual page contains.</p>
30563056
<p>The <a href="https://github.com/makaimc/fullstackpython.com/blob/gh-pages/source/theme/templates/base.html">base.html Jinja template</a> used to generate Full Stack Python
3057-
allows every page on Full Stack Python to have consistent HTML but
3058-
dynamically generate the pieces that should change between pages when
3057+
allows every page on the site to have consistent HTML but
3058+
dynamically generate the pieces that need to change between pages when
30593059
the <a href="/static-site-generator.html">static site generator</a> executes. The below
30603060
code from the <code>base.html</code> template shows that the meta description is up to child
30613061
templates to create.</p>
@@ -3076,18 +3076,22 @@ <h2>Why are template engines important?</h2>
30763076
generate the HTML output response when an HTTP request comes in for a
30773077
particular URL. </p>
30783078
<h2>Python template engines</h2>
3079-
<p>There are several popular Python template engines. Template engines have to
3080-
walk the spectrum between allowing arbitrary code execution and granting only
3081-
a limited set of capabilities via template tags.</p>
3079+
<p>There are several popular Python template engines. A template engine implementation
3080+
will fall somewhere on the spectrum between allowing arbitrary code execution and
3081+
granting only a limited set of capabilities via template tags. A rough visual of
3082+
the code in template spectrum can be seen below for four of the major Python
3083+
template engines.</p>
3084+
<p><img src="theme/img/template-logic-spectrum.png" width="100%" alt="." class="technical-diagram" style="border-radius: 5px;"></p>
30823085
<h3>Jinja</h3>
3083-
<p><a href="http://jinja.pocoo.org/">Jinja</a>, also known as "Jinja2" is a popular Python
3086+
<p><a href="http://jinja.pocoo.org/">Jinja</a>, also known as "Jinja2", is a popular Python
30843087
template engine written as an independent open source project, unlike some
30853088
template engines that are provided as part of a larger web framework.</p>
30863089
<p>Major Python open source applications such as the
30873090
<a href="/configuration-management.html">configuration management</a> tools Ansible
30883091
and <a href="https://github.com/saltstack/salt">SaltStack</a>
30893092
as well as the <a href="/static-site-generator.html">static site generator</a> Pelican use
30903093
the Jinja template engine by default for generating output files.</p>
3094+
<p>There's a whole lot more to learn about Jinja on the <a href="/jinja2.html">Jinja2</a> page.</p>
30913095
<h3>Django templating</h3>
30923096
<p>Django comes with its
30933097
<a href="https://docs.djangoproject.com/en/dev/topics/templates/">own template engine</a>
@@ -3485,6 +3489,57 @@ <h3>Static site generator resources</h3>
34853489
is a tutorial I wrote to use the Full Stack Python source code to create
34863490
and deploy your first static site.</p>
34873491
</li>
3492+
</ul>
3493+
<h1>Jinja2</h1>
3494+
<p>Jinja2 is a Python <a href="/template-engines.html">template engine</a> used to create
3495+
HTML, XML or other markup formats that are returned to the user via an
3496+
HTTP response.</p>
3497+
<h2>Why is Jinja2 useful?</h2>
3498+
<p>Jinja2 didn't invent the templating concept. In fact, Jinja2's syntax is
3499+
inspired by Django's built-in template engine, which was released years
3500+
earlier. There were many template engines, such as <a href="https://en.wikipedia.org/wiki/JavaServer_Pages">JavaServer Pages (JSPs)</a> </p>
3501+
<p>Jinja2 is most useful because it has consistent template tag syntax and the
3502+
project is cleanly extracted as
3503+
<a href="https://github.com/mitsuhiko/jinja2">an independent open source project</a> so
3504+
it can be used a dependency by other code libraries.</p>
3505+
<p>Jinja2 strikes a thoughtful balance on the template engine spectrum where
3506+
on one end you can embed arbitrary code in the templates and the other
3507+
end a developer can code whatever she wants.</p>
3508+
<h2>What projects depend on Jinja2?</h2>
3509+
<p>Jinja2 is a commonly-used templating engine for
3510+
<a href="/web-frameworks.html">web frameworks</a> such as <a href="/flask.html">Flask</a>,
3511+
<a href="/bottle.html">Bottle</a> <a href="/morepath.html">Morepath</a> and, as of its 1.8 update,
3512+
optionally <a href="/django.html">Django</a> as well. Jinja2 is also used as a template
3513+
language by <a href="/configuration-management.html">configuration management</a> tool
3514+
Ansible and the <a href="/static-site-generators.html">static site generator</a> Pelican,
3515+
among many other similar tools.</p>
3516+
<p>The idea is that if a developer already knows Jinja2 from working with one
3517+
project then the exact same syntax and style can be used in another project
3518+
that requires templating. The re-use reduces the learning curve and saves the
3519+
open source project author from having to reinvent a new templating style.</p>
3520+
<h3>Jinja2 resources</h3>
3521+
<ul>
3522+
<li>
3523+
<p>Real Python has a nice
3524+
<a href="https://realpython.com/blog/python/primer-on-jinja-templating/">Jinja2 primer</a>
3525+
with many code examples to show how to use the template engine.</p>
3526+
</li>
3527+
<li>
3528+
<p>The <a href="http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-ii-templates">second part of the Flask mega tutorial</a>
3529+
is all about Jinja2 templates. It walks through control flow, template inheritance
3530+
and other standard features of the engine.</p>
3531+
</li>
3532+
<li>
3533+
<p><a href="http://jonathanchu.is/posts/upgrading-jinja2-templates-django-18-with-admin/">Upgrading to Jinja2 Templates in Django 1.8 With Admin</a>
3534+
shows how to fix an issue that can occur with Django 1.8 and using Jinja2 as
3535+
the template engine.</p>
3536+
</li>
3537+
<li>
3538+
<p>The official
3539+
<a href="http://jinja.pocoo.org/docs/dev/templates/">Jinja2 template designer documentation</a>
3540+
is exceptionally useful both as a reference as well as a full read-through
3541+
to understand how to properly work with template tags.</p>
3542+
</li>
34883543
</ul>
34893544
<h1>Data</h1>
34903545
<p>Data is an incredibly broad topic but it can be broken down into many
Collapse file

‎api-creation.html‎

Copy file name to clipboardExpand all lines: api-creation.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
365365
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
366366
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
367367
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
368+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
368369
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
369370
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
370371
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎api-integration.html‎

Copy file name to clipboardExpand all lines: api-integration.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
220220
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
221221
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
222222
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
223+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
223224
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
224225
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
225226
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎application-dependencies.html‎

Copy file name to clipboardExpand all lines: application-dependencies.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
284284
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
285285
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
286286
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
287+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
287288
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
288289
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
289290
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎application-programming-interfaces.html‎

Copy file name to clipboardExpand all lines: application-programming-interfaces.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
197197
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
198198
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
199199
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
200+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
200201
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
201202
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
202203
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎best-python-resources.html‎

Copy file name to clipboardExpand all lines: best-python-resources.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
318318
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
319319
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
320320
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
321+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
321322
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
322323
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
323324
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎best-python-videos.html‎

Copy file name to clipboardExpand all lines: best-python-videos.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
249249
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
250250
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
251251
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
252+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
252253
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
253254
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
254255
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎bottle.html‎

Copy file name to clipboardExpand all lines: bottle.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
185185
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
186186
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
187187
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
188+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
188189
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
189190
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
190191
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>
Collapse file

‎caching.html‎

Copy file name to clipboardExpand all lines: caching.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Ta
164164
<a href="/template-engines.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Template Engines</a>
165165
<a href="/web-application-security.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Web Application Security</a>
166166
<a href="/static-site-generator.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Static Site Generators</a>
167+
<a href="/jinja2.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Jinja2</a>
167168
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Data</a>
168169
<a href="/databases.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>Databases</a>
169170
<a href="/no-sql-datastore.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>NoSQL Data Stores</a>

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.