https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-ix-pagination

Misc

https://github.com/mgood/flask-debugtoolbar

Questions

@app.route('/login', methods=['GET', 'POST'])
def login():
    if flask.request.method == 'POST':
        ...

http://flask.pocoo.org/docs/1.0/quickstart/#sessions
https://stackoverflow.com/questions/22463939/demystify-flask-app-secret-key/48596852#48596852

Trailing slash in URLs

From http://flask.pocoo.org/docs/1.0/quickstart/#unique-urls-redirection-behavior:

The canonical URL for the projects endpoint has a trailing slash. It’s similar to a folder in a file system. If you access the URL without a trailing slash, Flask redirects you to the canonical URL with the trailing slash.

The canonical URL for the about endpoint does not have a trailing slash. It’s similar to the pathname of a file. Accessing the URL with a trailing slash produces a 404 “Not Found” error. This helps keep URLs unique for these resources, which helps search engines avoid indexing the same page twice.

Application and request contexts

https://stackoverflow.com/questions/20938619/whats-the-difference-between-application-and-request-contexts
https://stackoverflow.com/questions/15083967/when-should-flask-g-be-used

Application context is a lighter version of full-blown request context.

flask-wtf

class MyForm(FlaskForm):
    name = StringField('name', validators=[DataRequired()])
    submit = SubmitField('say hello')
<form action="" method="post" novalidate>
    
    <p>
        <br>
        
    </p>
    <p></p>
</form>
@app.route('/submit', methods=('GET', 'POST'))
def submit():
    form = MyForm()
    if form.validate_on_submit():
        return redirect('/success')
    else:
        return render_template('wtf.jinja', form=form)