aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r--bh20simplewebuploader/main.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 51048a4..fc145e6 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -7,6 +7,7 @@ import logging
import os
import sys
import re
+import redis
import string
import ruamel.yaml as yaml
import pkg_resources
@@ -252,8 +253,19 @@ def send_home():
"""
Send the front page.
"""
-
- return render_template('home.html', menu='HOME', load_map=True)
+ redis_client = redis.Redis(host=os.environ.get('HOST', 'localhost'),
+ port=os.environ.get('PORT', 6379),
+ db=os.environ.get('REDIS_DB', 0))
+ tweets = []
+ for tweet_id in redis_client.zrevrange('bh20-tweet-score:',
+ 0, -1):
+ tweets.append(
+ {k.decode("utf-8"): v.decode("utf-8") for k, v in
+ redis_client.hgetall(tweet_id).items()}
+ )
+ return render_template('home.html', menu='HOME',
+ tweets=tweets,
+ load_map=True)
@app.route('/upload')