main.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:tellmeabout.coffee 作者: billyfung 项目源码 文件源码
def index():
    """Lists the coffeez"""
    coffees = memcache.get(ALL_COFFEES_KEY)
    if not coffees:
        coffees = Coffee.query(Coffee.active == True).fetch()
        # cannot store all images into memcached due to size limits
        for coffee in coffees:
            coffee.image = None
        memcache.set(ALL_COFFEES_KEY, coffees)
    roaster_query = memcache.get(ALL_ROASTERS_KEY)
    if not roaster_query:
        roaster_query = Coffee.query(projection=["roaster"], distinct=True).fetch()
        memcache.set(ALL_ROASTERS_KEY, roaster_query)
    roasters = [data.roaster for data in roaster_query]
    return render_template('index.html', coffees=coffees, roasters=roasters)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号