How to do it...

Have a look at the following layout:

flask_app/ 
    - run.py 
    my_app/ 
        - __init__.py 
        - product/ 
            - __init__.py 
            - views.py 
            - models.py 
        - templates/ 
            - base.html 
            - home.html 
            - product.html 
        - static/ 
            - js/ 
                - bootstrap.min.js 
            - css/ 
                - bootstrap.min.css 
                - main.css 

In the preceding layout, static/css/bootstrap.min.css and static/js/bootstrap.min.js are standard files that can be downloaded from the Bootstrap website mentioned in the Getting ready section. The run.py file remains the same, as always. The rest of the application building process is as follows:

First, define the models in my_app/product/models.py. In this chapter, we will work on a simple, non-persistent key-value store. We will start with a few hardcoded product records ...

Get Flask Framework Cookbook - Second Edition 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.