Django Twitter Flux
A small Django app to persist a pool of the last X number of tweets from a set of twitter accounts. These accounts can be mapped to configurable
feeds which are basically aggregators so you can have timelines with multiple users and manage associations in the Admin.
pip install django-twitterflux
twitterfluxto your INSTALLED_APPS
Create a Twitter App and add the credentials to your
TWITTER_CONSUMER_KEY = "XX" TWITTER_CONSUMER_SECRET = "XX" TWITTER_ACCESS_KEY = "XX" TWITTER_ACCESS_SECRET = "XX"
TWITTER_FEEDSfeeds tuple to your
settings.pywhere the first element is an
MAIN_FEED = 'Main' OTHER_FEED = 'Other' TWITTER_FEEDS = ( (1, MAIN_FEED), (2, OTHER_FEED), )
Optionally also add
TWITTER_BUFFER_SIZEspecifying the maximum number of tweets to keep from each account at any time (default is
- Add some twitter accounts in your Admin, you will be able to assign them to multiple
- Run the management command on a cron tab:
./manage.py retrieve_tweets [-v 2]
- In your views use
twitterflux.utilsmodule to get list of tweets for a specific Feed, or all tweets.
- Sample Django App provided.