# # Handles GET /guestbook -- returns a list of items in the guestbook # with a form to add more. # from flask import current_app, escape import redis # Connect to redis. This is run only when this file is loaded; as # long as the pod is alive, the connection is reused. redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0) def main(): messages = redisConnection.lrange('guestbook', 0, -1) items = [("
  • %s
  • " % escape(m.decode('utf-8'))) for m in messages] ul = "" % "\n".join(items) return """

    Guestbook


    %s """ % ul