Flask Framework Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

Flask recommends a specific way of organizing static files in an application, as follows:

my_app/ 
    - app.py 
    - config.py 
    - __init__.py 
    - static/ 
       - css/ 
        - js/ 
        - images/ 
            - logo.png 

While rendering this in templates (say, the logo.png file), we can refer to the static files using the following code:

<img src='/static/images/logo.png'>