A simple website to guide your team playing College Football Risk.
You'll need to create a .env
file in the repo root with these contents:
DOMAIN="localhost"
HTTP_PORT=8080
THE_GOOD_GUYS="Michigan"
GOOD_GUYS_DISCORD_LINK="..."
REDDIT_CLIENT_ID="..."
REDDIT_CLIENT_SECRET="..."
DISCORD_CLIENT_ID="..."
DISCORD_CLIENT_SECRET="..."
You will need to create a Reddit "app".
- Go to https://www.reddit.com/prefs/apps
- Click "create another app...".
- Give it a sensible name.
- Pick "Script".
- Set "redirect uri" to
http://localhost:8080/reddit_callback
. - Click "create app".
- Reload the page.
- Under "developed applications" at the bottom, find your app and click "edit".
- Under "personal use script" will be your
REDDIT_CLIENT_ID
. - "secret" is your
REDDIT_CLIENT_SECRET
. - Do not share these with anyone!
You will also need to create a Discord "app".
- Go to https://discord.com/developers/applications
- Make an account/sign in
- Click "New Application"
- Give it an even more sensible name
- Click on "OAuth2" on the left hand sidebar
- Copy the client ID to the .env file as your
DISCORD_CLIENT_ID
- Generate a secret and copy that to the .env file as your
DISCORD_CLIENT_SECRET
- Enter your redirect URL:
http://localhost:8080/discord_callback
. - Scroll down and save changes
- Do not share these with anyone!
The app is designed to run on a *nix system, but it can be done on Windows too. Message EpicWolverine if you need WSL help.
sudo apt install python3 python3-venv make sqlite3
make install_venv
- If the venv is giving you a hard time, you can just install the dependancies globally with
pip install -r requirements.txt
. I had issues with the venv on WSL. - Source the venv in future terminals with
source venv/bin/activate
.
- If the venv is giving you a hard time, you can just install the dependancies globally with
- Run
./init_db.sh
to initilize the database. - Run
python ingest_orders.py <path>
to fill the DB with some data. - Run
python flask_app.py
to start the webserver.
If you want to deploy this as a webapp, a useful and relatively cheap hosting service is PythonAnywhere ($5/mo) at https://www.pythonanywhere.com
- Make an account.
- Either open a Bash console via the dashboard or SSH into PythonAnywhere.
- To SSH into PythonAnywhere through VSCode, you'll want to make sure you're using Remote - SSH Version v0.107.1. Later versions seem broken with PythonAnywhere.
- Clone the repo into your home directory.
- Create your .env as outlined in Setup but set
DOMAIN=<username>.pythonanywhere.com HTTP_PORT=80
- Go to the "Web" tab of your PythonAnywhere dashboard.
- Add a new webapp that for the purpose of this tutorial will be
<username>.pythonanywhere.com
- Select "Flask" as your web framework.
- Select Python 3.10 as your Python version.
- Point the path to
/home/<username>/cfbr_orders/flask_app.py
- This will delete whatever is in
flask_app.py
. Just restore it using git:cd /home/<username>/cfbr_orders git checkout -- flask_app.py
- Under "Code", set your working directory AND source code to
/home/<username>/cfbr_orders
- Scroll up and "Reload"
<username>.pythonanywhere.com
- Set your Discord and Reddit redirect URLs to
http://<username>.pythonanywhere.com:80/<app>_callback
in the app settings pages on each service. - Things should be working! Visit
<username>.pythonanywhere.com
and get started dominating the Risk board!