Current File : //usr/share/doc/python-jinja2-2.7.2/html/intro.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Introduction &mdash; Jinja2 2.7.2 documentation</title>
    
    <link rel="stylesheet" href="_static/jinja.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '2.7.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Jinja2 2.7.2 documentation" href="index.html" />
    <link rel="next" title="API" href="api.html" />
    <link rel="prev" title="Welcome to Jinja2" href="index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="api.html" title="API"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Welcome to Jinja2"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Jinja2 2.7.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="introduction">
<h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h1>
<p>This is the documentation for the Jinja2 general purpose templating language.
Jinja2 is a library for Python that is designed to be flexible, fast and secure.</p>
<p>If you have any exposure to other text-based template languages, such as Smarty or
Django, you should feel right at home with Jinja2.  It&#8217;s both designer and
developer friendly by sticking to Python&#8217;s principles and adding functionality
useful for templating environments.</p>
<div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2>
<p>Jinja2 works with Python 2.6.x, 2.7.x and &gt;= 3.3.  If you are using Python
3.2 you can use an older release of Jinja2 (2.6) as support for Python 3.2
was dropped in Jinja2 version 2.7.</p>
<p>If you wish to use the <a class="reference internal" href="api.html#jinja2.PackageLoader" title="jinja2.PackageLoader"><tt class="xref py py-class docutils literal"><span class="pre">PackageLoader</span></tt></a> class, you will also
need setuptools or distribute installed at runtime.</p>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
<p>You have multiple ways to install Jinja2.  If you are unsure what to do, go
with the Python egg or tarball.</p>
<div class="section" id="as-a-python-egg-via-easy-install">
<h3>As a Python egg (via easy_install)<a class="headerlink" href="#as-a-python-egg-via-easy-install" title="Permalink to this headline">¶</a></h3>
<p>You can install the most recent Jinja2 version using <a class="reference external" href="http://peak.telecommunity.com/DevCenter/EasyInstall">easy_install</a> or <a class="reference external" href="http://pypi.python.org/pypi/pip">pip</a>:</p>
<div class="highlight-python"><pre>easy_install Jinja2
pip install Jinja2</pre>
</div>
<p>This will install a Jinja2 egg in your Python installation&#8217;s site-packages
directory.</p>
<p>(If you are installing from the Windows command line omit the <cite>sudo</cite> and make
sure to run the command as user with administrator rights)</p>
</div>
<div class="section" id="from-the-tarball-release">
<h3>From the tarball release<a class="headerlink" href="#from-the-tarball-release" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>Download the most recent tarball from the <a class="reference external" href="http://pypi.python.org/pypi/Jinja2">download page</a></li>
<li>Unpack the tarball</li>
<li><tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></tt></li>
</ol>
<p>Note that you either have to have setuptools or <a class="reference external" href="http://pypi.python.org/pypi/distribute">distribute</a> installed;
the latter is preferred.</p>
<p>This will install Jinja2 into your Python installation&#8217;s site-packages directory.</p>
</div>
<div class="section" id="installing-the-development-version">
<h3>Installing the development version<a class="headerlink" href="#installing-the-development-version" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>Install <a class="reference external" href="http://git-scm.org/">git</a></li>
<li><tt class="docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">git://github.com/mitsuhiko/jinja2.git</span></tt></li>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">jinja2</span></tt></li>
<li><tt class="docutils literal"><span class="pre">ln</span> <span class="pre">-s</span> <span class="pre">jinja2</span> <span class="pre">/usr/lib/python2.X/site-packages</span></tt></li>
</ol>
<p>As an alternative to steps 4 you can also do <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">develop</span></tt>
which will install the package via distribute in development mode.  This also
has the advantage that the C extensions are compiled.</p>
</div>
<div class="section" id="markupsafe-dependency">
<h3>MarkupSafe Dependency<a class="headerlink" href="#markupsafe-dependency" title="Permalink to this headline">¶</a></h3>
<p>As of version 2.7 Jinja2 depends on the <a class="reference external" href="http://pypi.python.org/pypi/MarkupSafe">MarkupSafe</a> module.  If you
install Jinja2 via <cite>pip</cite> or <cite>easy_install</cite> it will be installed
automatically for you.</p>
</div>
</div>
<div class="section" id="basic-api-usage">
<h2>Basic API Usage<a class="headerlink" href="#basic-api-usage" title="Permalink to this headline">¶</a></h2>
<p>This section gives you a brief introduction to the Python API for Jinja2
templates.</p>
<p>The most basic way to create a template and render it is through
<a class="reference internal" href="api.html#jinja2.Template" title="jinja2.Template"><tt class="xref py py-class docutils literal"><span class="pre">Template</span></tt></a>.  This however is not the recommended way to
work with it if your templates are not loaded from strings but the file
system or another data source:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">jinja2</span> <span class="kn">import</span> <span class="n">Template</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">template</span> <span class="o">=</span> <span class="n">Template</span><span class="p">(</span><span class="s">&#39;Hello {{ name }}!&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">template</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;John Doe&#39;</span><span class="p">)</span>
<span class="go">u&#39;Hello John Doe!&#39;</span>
</pre></div>
</div>
<p>By creating an instance of <a class="reference internal" href="api.html#jinja2.Template" title="jinja2.Template"><tt class="xref py py-class docutils literal"><span class="pre">Template</span></tt></a> you get back a new template
object that provides a method called <a class="reference internal" href="api.html#jinja2.Template.render" title="jinja2.Template.render"><tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt></a> which when
called with a dict or keyword arguments expands the template.  The dict
or keywords arguments passed to the template are the so-called &#8220;context&#8221;
of the template.</p>
<p>What you can see here is that Jinja2 is using unicode internally and the
return value is an unicode string.  So make sure that your application is
indeed using unicode internally.</p>
</div>
<div class="section" id="experimental-python-3-support">
<h2>Experimental Python 3 Support<a class="headerlink" href="#experimental-python-3-support" title="Permalink to this headline">¶</a></h2>
<p>Jinja 2.7 brings experimental support for Python &gt;=3.3.  It means that all
unittests pass on the new version, but there might still be small bugs in
there and behavior might be inconsistent.  If you notice any bugs, please
provide feedback in the <a class="reference external" href="http://github.com/mitsuhiko/jinja2/issues">Jinja bug tracker</a>.</p>
<p>Also please keep in mind that the documentation is written with Python 2
in mind, you will have to adapt the shown code examples to Python 3 syntax
for yourself.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
  <img class="logo" src="_static/jinja-small.png" alt="Logo"/>
</a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Introduction</a><ul>
<li><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
<li><a class="reference internal" href="#installation">Installation</a><ul>
<li><a class="reference internal" href="#as-a-python-egg-via-easy-install">As a Python egg (via easy_install)</a></li>
<li><a class="reference internal" href="#from-the-tarball-release">From the tarball release</a></li>
<li><a class="reference internal" href="#installing-the-development-version">Installing the development version</a></li>
<li><a class="reference internal" href="#markupsafe-dependency">MarkupSafe Dependency</a></li>
</ul>
</li>
<li><a class="reference internal" href="#basic-api-usage">Basic API Usage</a></li>
<li><a class="reference internal" href="#experimental-python-3-support">Experimental Python 3 Support</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="index.html" title="previous chapter">Welcome to Jinja2</a></li>
      <li>Next: <a href="api.html" title="next chapter">API</a></li>
  </ul></li>
</ul>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/intro.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy; Copyright 2008, Armin Ronacher.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
    </div>
  </body>
</html>
blog

blog

1win — скачать приложение букмекерской конторы.1701

1win — скачать приложение букмекерской конторы ▶️ ИГРАТЬ Содержимое Установка и регистрация 1win apk Регистрация на 1win Основные функции и преимущества 1win В мире ставок и азарта 1win является одним из самых популярных букмекеров. Компания была основана в 2018 году и с тех пор стала одним из лидеров на рынке. …

Read More »

1win — официальный сайт букмекерской конторы 1вин.4184 (2)

1win — официальный сайт букмекерской конторы 1вин ▶️ ИГРАТЬ Содержимое 1win – Официальный Сайт Букмекерской Конторы 1вин Оформление и Дизайн 1win Функциональность и Инструменты 1win Анализ игроков и команд Бонусы и Промокоды 1вин Промокоды для постоянных клиентов Безопасность и Надежность Отзывы и Рейтинг В мире ставок и азарта 1win – …

Read More »

1win официальный сайт букмекера — Обзор и зеркало для входа.450

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Преимущества Официального Сайта 1вин Зеркало для входа Обзор и Зеркало для Входа Преимущества 1win Зеркало для Входа Преимущества и Функции 1win Удобство и доступность В мире ставок и азарта 1win является одним из …

Read More »

1win официальный сайт букмекера — Обзор и зеркало для входа.477

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Преимущества 1win Обзор и Зеркало для Входа Преимущества 1вин Зеркало для Входа В мире ставок и азарта 1вин является одним из самых популярных букмекеров, предлагающих широкий спектр услуг для игроков. В этой статье …

Read More »

1win — официальный сайт букмекерской конторы 1вин.3301

1win — официальный сайт букмекерской конторы 1вин ▶️ ИГРАТЬ Содержимое Официальный сайт букмекерской конторы 1вин Быстрый доступ к ставкам и линиям Преимущества быстрого доступа Преимущества и функции официального сайта 1вин Функции официального сайта 1вин: В мире ставок и азарта 1вин – это имя, которое ассоциируется с надежностью, быстротой и комфортом. …

Read More »

1win — скачать приложение букмекерской конторы.534

1win — скачать приложение букмекерской конторы ▶️ ИГРАТЬ Содержимое Установка приложения 1win Функциональность приложения 1win Главные функции Преимущества использования приложения 1win Как скачать приложение 1win Шаг 1: Установка 1win apk Шаг 2: Установка 1win на ваше устройство Шаг 3: Регистрация и вход в приложение 1win В мире ставок и азарта …

Read More »

Онлайн казино с моментальным выводом и привлекательными бонусами

Онлайн казино с моментальным выводом и привлекательными бонусами Виртуальные гэмблинг-платформы с мгновенным выплатой средств становятся все более привлекательными среди пользователей, стремящихся к максимальному удобству и оперативности. В подобных онлайн-казино необходимо не только наличие обширного выбора развлечений, но и скорость обработки транзакций. Посредством новейших разработок, многочисленные сервисы, например, как вавада, предлагают …

Read More »

Официальный Сайт Играть в Онлайн Казино Pinco.1661 (3)

Пинко Казино Официальный Сайт – Играть в Онлайн Казино Pinco ▶️ ИГРАТЬ Содержимое Pinco Casino: Официальный Сайт Возможности Онлайн Казино Преимущества игроков в Pinco Казино Большой выбор игр Лучшие условия для игроков 24/7 поддержка Как Играть в Pinco Casino В мире онлайн-казино есть много вариантов для игроков, но не все …

Read More »

1win — скачать приложение букмекерской конторы.4289

1win — скачать приложение букмекерской конторы ▶️ ИГРАТЬ Содержимое Установка приложения 1win Функциональность приложения 1win Главные функции Преимущества использования приложения 1win Как скачать приложение 1win Обзор безопасности приложения 1win В мире ставок и азарта 1вин является одним из самых популярных букмекерских контор, которые предлагают своим клиентам широкий спектр услуг и …

Read More »

Cresus casino en ligne Inscription et connexion.2051

Cresus casino en ligne – Inscription et connexion ▶️ JOUER Содержимое Cresus Casino en Ligne : Inscription et Connexion Inscription au Cresus Casino Connexion au Cresus Casino Inscription au Cresus Casino en Ligne Création de votre compte Cresus Casino Connexion au Cresus Casino en Ligne Connexion avec votre compte Cresus …

Read More »