title: Flask: How to send data from python script to HTML
body: <p>I have a python script returning a list and I would like to send those data to HTML for building a appropriate template.</p>
  
  <p>script.py:</p>
  
  <pre><code>def database():
   try:
    conn = psycopg2.connect("dbname='DataTeste' user='user1' host='localhost' password='123'")
   except:
    return "Impossible to connect to the database, check your code."
  
   cur = conn.cursor()
   conn.set_client_encoding('LATIN1')
   cur.execute("SELECT * FROM customers") 
   rows = cur.fetchall()
  
   return rows
  </code></pre>
  
  <p>Now I want to receive this script in some template. Anyone can help me with that?</p>