Skip to content

nko2/whyattend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

World of Tanks CW Attendance Tracker

This web application helps a clan keep track of the clan war attendance of its players and with gold payouts.

Dependencies

  • Python 2.7+
  • Various Python libraries (See requirements.txt) These can be installed via "pip install -r requirements.txt"

Deployment

As a Python WSGI application, this web application can be deployed in various ways. See the Flask documentation (http://flask.pocoo.org/docs/deploying/) for further information.

Configuration

  • Copy whyattend/config.py to local_config.py and adjust the settings.
  • Put your clan's logo into whyattend/static/img/clanicons.
  • Replace whyattend/static/img/header.jpg with an image of your choice.

After deployment, the initial database schema should be generated by opening /createdb?API_KEY=<configured API KEY> in a browser.

The clan member roles can be synchronized with Wargaming's server by opening /sync-players/<clanid>/?API_KEY=<configured API KEY>

config.API_KEY should be set to something random and secret, so only you can trigger the synchronization.

This can be automated by a cron script, e.g:

#!/bin/bash
# Synchronize WHY members
curl "http://myserver.com/sync-players/500014725?API_KEY=supersecret"

Deployment Example

Example 1:

apache2 + mod_wsgi

Follow the instructions from example 2 to install a virtual Python environment and use the provided wsgi_app.wsgi file as example.

The apache2 virtual host configuration could look like this:

WSGIDaemonProcess clanwars processes=1 threads=5
WSGIProcessGroup clanwars
WSGIScriptAlias /clanwars /var/www/clanwars/wsgi_app.wsgi

Alias /clanwars/static/ /var/www/clanwars/whyattend/static/
<Directory /var/www/clanwars/whyattend/static>
    Order allow,deny
    Allow from all
</Directory>

Example 2:

Tornado + Reverse Proxy (nginx/apache2)

On Debian 7 you'd have to do the following:

Adjust the settings in whyattend/config.py Then:

> apt-get install python python-pip python-virtualenv
> virtualenv ./myenv
> source ./myenv/bin/activate
> pip install -r requirements.txt
> pip install tornado

To start the server (here: Tornado):

> source ./myenv/bin/activate
> python runtornado.py

This will start a Tornado server listening on port 5001. It is recommended to let Tornado listen only on localhost and put it behind a web server such as nginx or apache.