How to install Flask Use Flask to create a minimal website Build routes in Flask to respond to website endpoints Use Variable Rules to pass parts of the URL to your functions as keyword parameters
Install:
pip install Flask
Development Mode:
run_local.sh:
#!/bin/bashexport FLASK_APP=app.pyexport FLASK_DEBUG=1flask run
app.py:
from flask import Flaskapp = Flask(__name__)@app.route('/')def hello_world(): return 'Hello world!'@app.route('/foo/')def foo(): return 'The foo page'@app.route('/bar')def bar(): return 'The bar page'@app.route('/hello/')@app.route('/hello/')def say_hello(name=None): return 'Hello {}'.format(user)