Pretweeting is now open source! All the code needed to deploy an instance of the game pretweeting is in this repository.
- Django 1.0+
- Python 2.4+
- Python libraries: pytz, pexpect
To set up a local instance of pretweeting, follow the following steps.
Download the source code to a directory on your local machine.
Set up an empty MySQL database.
Set up a (twitter oAuth client)[http://twitter.com/oauth] and remember the key/secret.
Fill out the
pretweeting/apps/config/environment/local.pyfile with appropriate settings for your database and twitter access. You'll need:
# for database access DATABASE_USER = '---' DATABASE_PASSWORD = '---' DATABASE_HOST = '' # for local data storage LOCAL_DATA_DIR = "/Users/Gabe/pretweeting_data" BULK_INSERT_DIR = "/Users/Gabe/pretweeting_data/bulk_insert" # for accessing the streaming API TWITTER_USERNAME = '---' TWITTER_PASSWORD = '---' # for tweeting and DMing from pretweeting account TWITTER_OAUTH_TOKEN = '---' TWITTER_DM_SCREENNAME = '---' # for twitter authorization CONSUMER_KEY = '---' CONSUMER_SECRET = '---'
python manage.py syncdbto create the database tables.
python manage.py runserverto start the web server. At this point you should be able to navigate to localhost:8000 to see a game with empty data running.
To start the feed from twitter, you'll need to run two scripts continuously.
pretweeting/scripts/consume.pyopens a connection to the garden hose and files away batches of data into a folder in your local data data directory.
pretweeting/scripts/process.pyregularly consumes those data batch files and pushes them into the database.
Once you have the webserver and feed scripts running, that should be all you need! You can change parameters like how frequently prices are updated in the
Steps for setting up a remote server are largely similar. Let me know if you have any difficulties! Happy pretweeting!