Im trying to print html code that will also include variables, in this case its data from database with this code:
def displayHot():
myCursor = mongo.db.posts.find()
for result_object in myCursor:
print'''
Content-Type: text/html
<div class="card-header">
<h3 %s
</h3>
</div>
<div class="card-block">
<p> %s
</p>
<a class="panel-google-plus-image" href="{{url_for('Images', filename = 'Images/%s')}}"
</a>
</div"
''' % (result_object['uploader'], result_object['description'], result_object['file_name'])
and rendering it here:
@app.route('/', methods=['POST','GET'])
def home():
if request.method == 'GET':
return render_template('index.html', function = displayHot())
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