A weekly college football top 25 poll managed and voted on by users of /r/CFB, the college football subreddit.
This is the code repository for the /r/CFB Poll, hosted at https://poll.redditcfb.com/ where a select group of users of the subreddit /r/CFB vote weekly on their top 25 football teams. The poll is currently managed by myself (u/sirgippy) and the other /r/CFB moderators. The poll has been in operation since 2010 and this is the third iteration of the poll site, currently built in django and Python 2.7 while making heavy use of Boostrap and jQueryUI.
I like the added features of taiga.io versus the issue board on GitHub, so you can find the backlog here and an issue board here.
The site was developed using Ubuntu, but has been confirmed to work on OS X and should be fine on any other *nix. It's probably possible to get it working in Windows too, but would probably require some finagling. It's deployed to Heroku.
The site exclusively uses Python Social Auth and OAuth2 interactions on reddit to handle authentication. This is great from a poll management perspective, but can make administrative set-up and local deployment a bit more difficult.
I recommend using a virtual environment because some of the dependencies are old and probably shouldn't be your default versions.
Hoping to update to Python 3 soon but for now 🤷
The site is currently configured to use PostgreSQL. If you don't already have it, install it first (OS X setup tutorial).
Then, install the other python package dependencies, e.g.
pip install -r requirements.txt
pip install -r requirements_local.txt
(If you're on OS X and get a bug installing six, see here.)
Using django to provision a new database and have the site work is currently not possible as the site uses virtual models and queries are needed within the database to get the results views to work. Future versions may alleviate this requirement or provide scripts to get up and going, but at present we'll need a copy of the existing database.
A dump of the live site's database as of 10/8/2018 is here.
If you're using PostgreSQL, use psql rcfbpoll -f rcfbpoll.dump
to install it. Either match the credentials listed in /rcfbpoll/settings/base.py
or adjust base.py
to match the db's credentials as you set them. Don't create a django superuser yet; This will be done in a future step.
After logging into reddit, go to preferences > apps, scroll to the bottom, and click "create app". Fill out the form as required; the only field that actually matters is the "redirect uri" field. In that put https://127.0.0.1:8000/complete/reddit/
(or whatever you plan to use as your local domain).
Once your local deployment has been registered, you'll need to set up the key and secret provided to be imported in the django settings.
As configured, the site currently expects environment variables REDDIT_KEY
and REDDIT_SECRET
for each of the two strings provided. Alternatively, you could copy-paste them directly into /rcfbpoll/settings/base.py
.
You should now be ready to run the site and successfully log in. To run the site, use
python manage.py runsslserver 127.0.0.1:8000
Use your favorite browser to navigate to the site (ignore the certificate warning) and attempt to log in.
If successful, congratulations! You have successfully set up a local deployment of the poll site. As a last step, you should use the django shell to give yourself superuser privileges as ascribed here. You'll then be able to access the django admin console and create new objects on the site.