Django Activity Sync
Django-activitysync is an easy to use social activity aggregator for Django projects.
It can be used to store and display activity from a range of social networks (such as Twitter, Reddit, Google Reader, etc). Unlike other utilities for accessing and displaying activity, django-activitysync separates rendering from activity updating. All activity information is stored in the project's database using Django models, providing great performance for page requests. Updating activities happens through a Django management command, which can be automated by using a utility like cron.
Dependencies that must be meet to use the application:
$ pip install django-activitysync
$ easy_install django-activitysync
or clone from Bitbucket:
$ hg clone https://bitbucket.org/dancarroll/django-activitysync
and add social_auth to PYTHONPATH:
$ export PYTHONPATH=$PYTHONPATH:$(pwd)/django-activitysync/
$ cd django-activitysync $ sudo python setup.py install
Add activitysync to PYTHONPATH and installed applications:
INSTALLED_APPS = ( ... 'activitysync' )
Add desired providers to ACTIVITYSYNC_PROVIDERS setting:
ACTIVITYSYNC_PROVIDERS = ( 'activitysync.providers.googlereader.GoogleReaderProvider', 'activitysync.providers.twitterprovider.TwitterProvider', 'activitysync.providers.redditprovider.RedditProvider', )
Setup provider settings (dependent on which providers are added). Settings required for built-in providers are:
TWITTER_USERNAME = '' REDDIT_USERNAME = '' GOOGLEREADER_SHARED_RSS = '' # URL of your shared items RSS GOOGLEREADER_PUBLIC_URL = '' # URL to public page
Sync database to create needed models:
python manage.py syncdb
or (if you have South installed):
python manage.py migrate activitysync
Once configuration is completed, run the included management command to fetch activities for the configured providers:
python manage.py updateactivities
The command will print out all new activities to the command line. All activity items are stored with a unique guid value, so this command can be run as often as needed without worrying about creating duplicate values. In a production site, this command likely would be added to the crontab (or other scheduler) to run fairly often (such as every 30 minutes).
There are a few options available for the management command.
Use the --send-result option to send an email to the site admins (controlled by the Django ADMIN setting) with the newly added activities (no email is sent if there are no new items):
python manage.py updateactivities --send_result
Use the --dry-run option to output the items to the console, but not actually create items in the database:
python manage.py updateactivities --dry-run