Permalink
Browse files

Tweaks.

  • Loading branch information...
joshmarshall committed Oct 4, 2011
1 parent 9a13d33 commit 61588f664b3d73c30ce5108539927f7bcc9e3501
Showing with 64 additions and 4 deletions.
  1. +60 −0 README.md
  2. +4 −4 tweetwatcher.py
View
@@ -0,0 +1,60 @@
+TweetWatcher
+===========
+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.
+
+Usage
+-----
+It's fairly easy to setup after git'ing:
+
+```bash
+mkvirtualenv --no-site-packages tweetwatcher
+pip install -r requirements.txt
+python tweetwatcher.py & python serve.py
+```
+
+... although you should probably run it behind supervisord or something
+in production.
+
+It works pretty simply -- the tweetwatcher.py file publishes the incoming
+tweets from the streaming API to a Redis channel, and the serve.py
+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 serve.py 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 settings.py file in the main
+directory. It should look something like this:
+
+```python
+import tweetstream
+tweetstream.TWITTER_API_USER = "myTwitterName"
+tweetstream.TWITTER_API_PASSWORD = "myPassword"
+
+SETTINGS = {
+ "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 serve.py
+
+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.
+
+Feedback
+--------
+I'd love to hear about it if you use this somewhere or if you have any issues
+or suggestions.
+
+TODO:
+-----
+* Add a cache for reloading, etc.
+* Add a pre-fetch in case of server crashes and restarts
View
@@ -6,10 +6,10 @@
from settings import SETTINGS
except ImportError:
# No local settings
- SETTINGS = {
- "twitter_url": "/1/statuses/sample.json",
- "redis_pub_channel": "tweetwatcher"
- }
+ SETTINGS = {}
+
+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.