title: How do you use views.py to display mysql data in django?
body: <p>I am a beginner in python and am trying the tutorial below:
  <a href="http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-creating-a-dynamic-website/" rel="nofollow">http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-creating-a-dynamic-website/</a></p>
  
  <p>I have created a template with the following body:</p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;h1&gt;First Blog&lt;/h1&gt;
      &lt;hr /&gt;
      {% for post in posts %}
          &lt;div class="post"&gt;
          &lt;h2&gt;{{ post.title }}&lt;/h2&gt;
          &lt;h3&gt;Posted on {{ post.timestamp }} by {{ post.author }}&lt;/h3&gt;
          &lt;p&gt;{{ post.bodytext }}&lt;/p&gt;
          &lt;/div&gt;
          &lt;hr /&gt;
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>The views.py document has the following code:</p>
  
  <pre><code>from django.shortcuts import render_to_response
  from blog.models import posts
  def home(request):
      entries = posts.objects.all()[:10]
      return render_to_response('index.html', {'posts' : entries})
  </code></pre>
  
  <p>The website displays the following:</p>
  
  <pre><code>First Blog
  
  {% for post in posts %}
  {{ post.title }}
  
  Posted on {{ post.timestamp }} by {{ post.author }}
  
  {{ post.bodytext }}
  
  {% endfor %}
  </code></pre>
  
  <p>How do I get the website to display the data from my database?</p>