title: printing HTML and inserting variables using python-flask
body: <p>Im trying to print html code that will also include variables, in this case its data from database with this code:</p>
  
  <pre><code>def displayHot():
  myCursor = mongo.db.posts.find()
  for result_object in myCursor:
          print''' 
          Content-Type: text/html
  
          &lt;div class="card-header"&gt;
          &lt;h3 %s
          &lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="card-block"&gt;
          &lt;p&gt; %s 
          &lt;/p&gt;
          &lt;a class="panel-google-plus-image" href="{{url_for('Images', filename = 'Images/%s')}}"
          &lt;/a&gt;
          &lt;/div" 
          ''' % (result_object['uploader'], result_object['description'], result_object['file_name'])
  </code></pre>
  
  <p>and rendering it here:</p>
  
  <pre><code>@app.route('/', methods=['POST','GET'])
  def home():
      if request.method == 'GET':
          return render_template('index.html', function = displayHot())
  </code></pre>
  
  <p>when i run it, i get the printed data in my cmd.. so my question is how can i print the html code so it will act as html code and not just a print command in cmd</p>