[python]Getting hands on with flask

This is interesting… Never knew we can put in logics in html tags…

So here is a simple demo…

from flask import Flask, render_template

app = Flask(__name__)


@app.route('/marvel/')
def list_marvel_heroes():
    marvel_heroes = [
        'Captain America',
        'Spider man',
        'Luna Snow',
        'Hulk',
        'Thor'
    ]

    return render_template('marvels.html', heroes = marvel_heroes)


if __name__ == '__main__':
    app.run(debug=True)

The html tags are:
Screen Shot 2018-05-01 at 4.26.28 AM.png

And the result is:
Screen Shot 2018-05-01 at 4.27.24 AM.png

Advertisements
This entry was posted in Python, Scripting and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s