Flask

From bibbleWiki
Revision as of 04:24, 23 May 2021 by Iwiseman (talk | contribs) (Created page with "=Introduction= Quick tour of the python framework flask =Getting Started= <syntaxhighlight lang="py"> from app import app @app.route('/') @app.route('/index') def index():...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Quick tour of the python framework flask

Getting Started

from app import app

@app.route('/')
@app.route('/index')
def index():
    user = {'username': 'Miguel'}
    return '''
<html>
    <head>
        <title>Home Page - Microblog</title>
    </head>
    <body>
        <h1>Hello, ''' + user['username'] + '''!</h1>
    </body>
</html>'''

Routing

Templates

So flask like others such pug or egs has templates