Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Running With Rifles Stats (RWRS)

Players statistics, servers list and more for the Running With Rifles (RWR) game as well as its Pacific and Edelweiss DLCs. Available at

Your everyday RWR companion tool!


  • Should work on any Python 3.x version
  • A modern web browser
  • A MySQL-compatible DBMS (MySQL, MariaDB, Percona, etc)
  • (Optional, but recommended) A uWSGI-capable web server
  • (Optional) Running With Rifles, if you need to extract data by using the commands below


  1. Clone this repo somewhere
  2. Copy .env.local to .env
  3. pip install -r requirements-dev.txt
  4. flask db upgrade
  5. bash scripts/


Copy the file to and fill in the configuration parameters.

Available configuration parameters are:

  • SECRET_KEY Set this to a complex random value
  • SERVER_NAME The IP or hostname where RWRS will be available

More informations on the two above can be found here.

  • DB_USERNAME Username to access the DBMS (production env only)
  • DB_PASSWORD Password to access the DBMS (production env only)
  • DB_UNIX_SOCKET If set, DB_HOST and DB_PORT will be ignored in favor of using this Unix socket to communicate with the DBMS (production env only)
  • DB_HOST Host of the DBMS (production env only)
  • DB_PORT Port of the DBMS (production env only)
  • DB_NAME Name of the database to use (production env only)
  • GA_TRACKING_ID A Google Analytics tracking ID used to track visits on RWRS (optional)
  • CACHE_THRESHOLD The maximum number of items the cache will store before it starts deleting some (see here for more configuration parameters related to Flask-Cache)
  • SERVERS_CACHE_TIMEOUT Cache duration of the servers list (in seconds)
  • PLAYERS_CACHE_TIMEOUT Cache duration of the players list as well as data for a single player (in seconds)
  • GRAPHS_DATA_CACHE_TIMEOUT Cache duration of the graphs data, both the players and the servers ones (in seconds)
  • STEAM_PLAYERS_CACHE_TIMEOUT Cache duration of the total number of players (in seconds)
  • STEAM_API_KEY A Steam API key
  • MAX_NUM_OF_PLAYERS_TO_TRACK_STATS_FOR How many players should RWRS track the stats for (top players storted by XP)
  • DISCORD_CLIENT_ID A Discord client ID
  • DISCORD_PUBLIC_KEY A Discord app public key
  • DISCORD_CLIENT_SECRET A Discord client secret
  • DISCORD_TESTING_GUILD A Discord guild ID where to register commands into, for testing purposes (defaults to None)

I'll let you search yourself about how to configure a web server along uWSGI.


  • Standalone

Run the internal web server, which will be accessible at http://localhost:8080:

flask run

Edit this file and change the interface/port as needed.

  • uWSGI

The uWSGI file you'll have to set in your uWSGI configuration is The callable is app.

  • Others

You'll probably have to hack with this application to make it work with one of the solutions described here. Send me a pull request if you make it work.

Extracting ranks data and images

The Flask command flask extract-ranks is used to extract and save all ranks data to a JSON file located at storage/data/ranks.json. It also retrieve, process (the actual images content isn't centered) and save all the RWR ranks images. They are saved at static/images/ranks/{country}/{rank ID}.png and static/images/ranks/{country}/{rank ID}_icon.png.

  1. pip install -r requirements-dev.txt
  2. flask extract-ranks --steamdir="{path to the Steam root directory}"

This command requires the game to be installed.

Extracting maps data

The Flask command flask extract-maps-data is used to extract and save all maps data to a JSON file located at storage/data/maps.json.

flask extract-maps-data --steamdir="{path to the Steam root directory}"

This command requires the game to be installed.

Extracting minimaps

The Flask command flask extract-minimaps is used to extract minimaps (the ones displayed when pressing on TAB). They are saved at static/images/maps/minimap/{map ID}.png and static/images/maps/minimap/{map ID}_thumb.png.

  1. pip install -r requirements-dev.txt
  2. flask extract-minimaps --steamdir="{path to the Steam root directory}"

This command requires the game to be installed.

Clearing cache

flask cc

Updating commands in Discord

flask update-discord-commands

Clearing old graphs data

Data older than one week old will be deleted.

flask clean-players-count

Computing promotions for all players

flask compute-promotions

Storing actual number of players (for graphs)

Will save the current number of Steam players which have RWR running, and the current number of players playing online.

flask get-players-count

Migrating the database

flask db upgrade

Updating the MaxMind GeoLite2 City database

More information in the script comments.

bash scripts/

Updating RWRS

More information in the script comments.

bash scripts/ [TYPE, default=fast, fast|full]

Generating RWRS REST API documentation

More information in the script comments.

bash scripts/

Retrieve and save the players stats in DB

flask save-players-stats [--reset]

Retrieve and save the ranked servers moderators

flask save-ranked-servers-mods

Import rwrtrack data

flask import-rwrtrack-data --directory="{path to the rwrtrack data directory}" [--reset]


You'll find credits and legal mentions here.


If you have suggestions or problems you can submit an issue here on GitHub or head over here.