title: How to render a variable in a django template?
body: <p>My goal is to write dynamically some urls of images in the HTML page. Urls are stored in a database. </p>
  
  <p>To do so, first I am trying to render a simple varable in a template.  Reading the docs and other sources, it should be done in 3 steps:</p>
  
  <p>For the configuration: <strong>in settings.py</strong></p>
  
  <pre><code>TEMPLATES = [
  {
      'OPTIONS': {
          'debug': DEBUG,
          'context_processors': [
              …
              'django.template.context_processors.request',
              'django.template.context_processors.debug',
              'django.template.context_processors.i18n',
              'django.template.context_processors.media',
              'django.template.context_processors.static',
              'django.template.context_processors.tz',
              'django.contrib.messages.context_processors.messages',            ],
      },
  },
  </code></pre>
  
  <p>]</p>
  
  <p>The variable name <strong>in the template: In MyHTMLFile.html</strong> is foo</p>
  
  <pre><code>…
  &lt;td&gt;MyLabel&lt;/td&gt;&lt;td&gt;&lt;p&gt;{{ foo }}&lt;/p&gt;&lt;/td&gt;&lt;td&gt;-----------&lt;/td&gt;
  …
  </code></pre>
  
  <p><strong>in the view.py</strong>, one of the lines</p>
  
  <pre><code>myvar1 ="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
  context = {foo: myvar1,}
  
  return render_to_response("MyHTMLFile.html", context, context_instance = RequestContext(request) )
  return render(request, 'MyHTMLFile.html', {foo: myvar1})
  return render_to_response("MyHTMLFile.html", context , context_instance=RequestContext(request) )
  return render(request, 'MyHTMLFile.html', context)
  </code></pre>
  
  <p>The html page is well rendered, but no data in the html table.</p>
  
  <p>Do you have an idea ? I am curious to know what i misunderstand.</p>
  
  <p>Regarding the versio, i am using: 
  python: Python 2.7.13
  django: 1.10.5 </p>
  
  <p>Thank you</p>