Browse files


  • Loading branch information...
joshmarshall committed Oct 4, 2011
1 parent 9a13d33 commit 61588f664b3d73c30ce5108539927f7bcc9e3501
Showing with 64 additions and 4 deletions.
  1. +60 −0
  2. +4 −4
@@ -0,0 +1,60 @@
+This is a simple little Tornado site that uses Redis, Websockets, and long-
+polling to push tweets to a web browser. It's useful for conferences and
+events where you want to encourage people to tweet with a certain hashtag.
+It's fairly easy to setup after git'ing:
+mkvirtualenv --no-site-packages tweetwatcher
+pip install -r requirements.txt
+python & python
+... although you should probably run it behind supervisord or something
+in production.
+It works pretty simply -- the file publishes the incoming
+tweets from the streaming API to a Redis channel, and the
+simply keeps the current clients in memory and subscribes to the Redis
+channel, sending out messages to all the clients as they come in.
+This means that you can spin up multiple on different ports and
+load balance between them behind nginx or something similar. Keep in mind that
+WebSockets will need access to each "native" Tornado instance.
+You (must) override the settings with a file in the main
+directory. It should look something like this:
+import tweetstream
+tweetstream.TWITTER_API_USER = "myTwitterName"
+tweetstream.TWITTER_API_PASSWORD = "myPassword"
+ "redis_pub_channel": "myawesomechannel",
+ "twitter_url": "/1/statuses/filter.json?track=foobar",
+ "port": 8081
+You can also set the port with a `--port 8888` argument to
+Graphics / Look and Feel
+Changing the look is as simply as editing the `static/style.css` file. You can
+also just swap out the `static/logo.png` file for your own logo if you are
+happy with the default color scheme, etc.
+I'd love to hear about it if you use this somewhere or if you have any issues
+or suggestions.
+* Add a cache for reloading, etc.
+* Add a pre-fetch in case of server crashes and restarts
@@ -6,10 +6,10 @@
from settings import SETTINGS
except ImportError:
# No local settings
- "twitter_url": "/1/statuses/sample.json",
- "redis_pub_channel": "tweetwatcher"
- }
+SETTINGS.setdefault("twitter_url", "/1/statuses/sample.json")
+SETTINGS.setdefault("redis_pub_channel", "tweetwatcher")
# Using blocking client because async one is underdeveloped
PUBLISH_CLIENT = redis.Redis()

0 comments on commit 61588f6

Please sign in to comment.