Website for letting users set their own flair on /r/anime. Built with Django as the backend and BootstrapVue (Bootstrap and embedded Vue.js) on the frontend.
- Reddit authentication.
- Admin page for editing the database.
- Default flairs available to all.
- Award flairs can be granted to specific users.
- Makes use of Reddit's emoji which works on both old/new reddit.
- Makes use of Reddit's flair templates. which also works on old/new reddit.
Python 3.6+
Setup Reddit authorised applications. This projects makes use of an 'web app' application for reading other users accounts (Set 'redirect uri' as https://example.com/accounts/reddit/login/callback/).
It also uses a separate 'personal use script' for an individual account that will be responsible for setting the flairs on the target subreddit. Ensure that account has subreddot permissions to set flairs on the target subreddit (moderator permissions).
You can make apps on Reddit here for a logged in account.
-
Copy template.env to .env and set the environment variables:
DJANGO_SECRET_KEY
should be a strong, secure secret key for Django.REDDIT_CLIENT_ID
Reddit Script Credentials.REDDIT_SECRET
Reddit Script Credentials.REDDIT_USERNAME
Reddit Script Credentials.REDDIT_USER_PASSWORD
Reddit Script Credentials.SUBREDDIT_NAME_TO_ACT_ON
The subreddit that the project will edit flairs on.WEBSITE_REDDIT_OAUTH_CLIENT_ID
OAuth Web App Credentials.WEBSITE_REDDIT_OAUTH_SECRET
OAuth Web App Credentials.DEBUG
Sets the website in debug mode or not. Unset to disable.USE_HTTPS
Controls whether the site is hosted via HTTPS. Uses HTTPS for OAuth redirect URIs and enables additional security settings. Unset to disable.ALLOWED_HOSTS
IfDEBUG
is not set, a list of hostnames where the application should be accessible, separated by semicolons. In debug mode, this setting is ignored and all hosts are allowed.
-
Create the website's database:
python manage.py migrate
. -
Create a superuser for the website:
python manage.py createsuperuser
. -
Run the server with:
manage.py runserver
-
Connect to admin interface server at:
http://127.0.0.1:8000/admin/
-
Add your host/domain name(s) to
Sites
on the admin page (.../admin/sites/site/
). -
Configure a Social application on the admin page (
.../admin/socialaccount/socialapp/
) for Reddit. Get that URI right http/https matters. -
Start setting up flairs in the website's database:
- Setup emoji on your subreddit.
- Setup flair templates on your subreddit
- Additional flair images can be added to the website in
flair/static/flairs
. - Use the admin page to setup a
Flair type
you will use your setup emoji and template from the above two steps. Example - Set up a
Flair type
with anachievement
Flair Type
and then award that flair inFlairs awardeds
, note the reddit username is case-sensitive.
-
Go to the flair site and login as a reddit user, test the set (
.../flair/set
) and wiki pages (.../wiki
) -
You should now be able to see the loaded flairs and set them.