This is an app for managing all aspects of a tournament – player managerment, round generation, match play, winner identification. This iteration uses the non-elimination, Swiss-system but it could easily be updated for simpler, elimination tournament schemas. Please feel free to contribute.
- This is for local installation via a virtual Linux server configuration. If this seems like too much work, you can always play with the live web version here.
- Install VirtualBox.
- Install Vagrant.
- Clone this project onto your machine.
- Inside the project folder, create a Linux environment:
vagrant up
. - Wait for installationt to complete.
- Go to your project folder and create a file named
my_path_data.py
containing these two lines of code:
root_url = '/tournament-manager'
html_index_root = '/'
- NOTE: If you're deploying to an actual server, you may need to change these paths depending on how you setup
000-default.conf
. I just did it this way so I could run it both locally and on a web server. Depending on which scenerio, none of the actual code needs to be changed - only the two lines inmy_path_data.py
.
- Within the project directory, login to the Linux environment:
vagrant ssh
. - Update:
sudo apt-get update
,sudo apt-get upgrade
. - Add software:
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
sudo apt-get install postgresql
sudo apt-get -qqy install python python-pip
sudo pip2 install --upgrade pip
sudo pip2 install flask packaging oauth2client redis passlib flask-httpauth
sudo pip2 install sqlalchemy flask-sqlalchemy psycopg2 bleach requests
- Create a directory for OAuth secrets:
sudo mkdir /var/www/tournament-manager-secrets
- Go to the Google API page and create a new project named
tournament-manager
. - Make sure the project is selected, then go to
Credentials
,Create credentials
,OAuth Client ID
. - On the resulting screen click
Configure consent screen
and underProduct name
putTournament Manager
and save - On the next screen select
Web application
. - Under
Authorized JavaScript origins
puthttp://localhost:5000
. - Under
Authorized redirect URIs
puthttp://localhost:5000
andhttp://localhost:5000/login
. - Click
Create
,OK
, then click the download icon on the right side of the screen underWeb client 1
. - Open it in a text editor, copy the contents, login to your Linux environment (
vagrant ssh
),sudo nano /var/www/tournament-manager-secrets/client_secret.json
, paste and save (ctr-o
,ctr-x
).
- Go to the Facebook app API page, click
Add a New App
, name ittournament-manager
and clickCreate App ID
. - Under
Settings
,Basic
clickAdd Platform
then selectWebsite
. - Under
Site URL
puthttp://localhost:5000
. - Leave the Facebook app settings page open, login to your Linux environment (
vagrant ssh
),sudo nano /var/www/tournament-manager-secrets/fb_client_secrets.json
, paste the following code into it:
{
"web": {
"app_id": "YOUR_APP_ID_HERE",
"app_secret": "YOUR_CLIENT_SECRET_HERE"
}
}
- Back at the Facebook app settings page, use the
App ID
andApp Secret
to fill in the above code.
cd
to you project folder and launch your Linux environment:vagrant ssh
.- Go to the vagrant shared folder:
cd /vagrant
. - Open PostgreSQL:
sudo -u postgres psql
. - Create the database:
\i tournament.sql
. - Give the
postgres
user a password:\password postgres
and use 'password' for the password (This is important since the project is setup for this username/password combo). - Exit:
\q
.
- In your Linux environment, launch the python server:
sudo /vagrant/python myapp.py
. - App should be live at
http://localhost:5000/tournament-manager
. - You'll be redirected to a login page, the Google and Facebook options store tournament data in the PostgreSQL database while Guest Mode login simply puts the data in
localStorage
.