Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flask application

In this simple Flask web application we have 3 files. app.py, a template, and the requirements.txt

from flask import Flask, request, render_template
app = Flask(__name__)

@app.route("/")
def hello():
    return render_template('echo.html')

@app.route("/echo", methods=['POST'])
def echo():
    return render_template('echo.html', text=request.form['text'])

{% embed include file="src/examples/flask-development/templates/echo.html)

flask
pytest