There's more...

Here is a real-world example, long_flask_program.py from a blog project this author created, using the Flask web framework as part of an online mentoring curriculum (https://github.com/crystalattice/Blogful):

@app.route("/") # Root (default) page to display when landing on web site@app.route("/page/<int:page>") # Specific site page@login_required # Force authenticationdef entries(page=1):    """    Query the database entries of the blog.    :param page: The page number of the site.    :return: Template page with the number of entries specified,     Next/Previous links, page number, and total number of    pages in the site    """    # Zero-indexed page    default_entries = 10    max_entries = 50    # Set the number of entries displayed per page    try: entry_limit ...

Get Secret Recipes of the Python Ninja now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.