Skip to content

rguedes/whyattend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 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"

Python 2.6 probably works too.

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 running python -c "from whyattend import model; model.init_db()" from the shell.

Make sure the replay_blob column in the generated replay table is large enough to hold WoT replay files. In MySQL, for example, the default BLOB type can only store around 64 kB. This can be changed by running the SQL statement ALTER TABLE replay MODIFY replay_blob LONGBLOB, for example. Additionally, MySQL defines a max_allowed_packet size in my.cnf, which might have to be increased.

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=<configured API KEY>"

Development

For developing the builtin development HTTP server is sufficient. To install the required dependencies simply run the following commands (assuming a bash shell and virtualenv using Python 2.7)

cd topleveldir
virtualenv devenv
source devenv/bin/activate
pip install -r requirements.txt
python server.py

which will start a web server listening on port 5000. The development server will automatically restart when it detects changes to the code.

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.

About

World of Tanks Attendance Tracker

Resources

License

Stars

Watchers

Forks

Packages

No packages published