Chess Clock Trivia is a trivia game where teams answer questions within a certain time limit.
This guide assumes that you have the following installed:
- Python 3.8
From redis.io:
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.
In Chess Clock Trivia, Redis is used to sync sessions between servers. Thus, to make Chess Clock Trivia run you need to install Redis.
(Note: This section is oriented towards installation on Mac OSX or Linux. If you are using Windows, there is a fork of Redis that can be installed on Windows. However, its use on Windows may be finicky.)
- Download the Redis source code by going here and downloading either the Stable
release. You should get a file called
redis-stable.tar.gz
. - Now switch over to root and extract Redis' source code to
/usr/local/lib/
:sudo su root mkdir -p /usr/local/lib/ chmod a+w /usr/local/lib/ tar -C /usr/local/lib/ -xzf redis-stable.tar.gz
- (Optional) You can now remove the original
redis-stable.tar.gz
file by doingrm redis-stable.tar.gz
- Now navigate into the
redis-stable
directory in/usr/local/bin
and run themake
command:cd /usr/local/lib/redis-stable/ make && make install
- (Optional but advised) You should test the Redis installation by running
make test
- Check that your Redis installation is working by running the commands below.
redis-cli --version redis-server --version
- Download the whole repository as a
.zip
file. You can do so by clicking this link. - Extract the contents of that
.zip
file. - Navigate to the root directory of Chess Clock Trivia:
cd PATH/TO/ROOT/DIRECTORY
- (Optional) You may choose to use a virtual environment to install the dependencies of Chess Clock Trivia.
- On Ubuntu/Linux, before creating the virtual environment, you may need to run:
sudo apt-get install python3-venv
- Create a virtual environment (
venv
) using the following command:python3 -m venv venv --prompt NAME_OF_VIRTUAL_ENV
- On Ubuntu/Linux, before creating the virtual environment, you may need to run:
- Install all dependencies of Chess Clock Trivia by running:
pip3 install -r requirements.txt
The Chess Clock Trivia server can be started by following these steps (note: this assumes that you have followed the steps above and installed Chess Clock Trivia).
- Navigate to the root directory of Chess Clock Trivia:
cd PATH/TO/ROOT/DIRECTORY
- Start the redis server by running:
redis-server
- Upon running the redis server you should get an image like this:
Take note of the port (circled in red) that is generated. In the above image the port is
6379
, but the port may differ from machine to machine. - Create the environment variable
REDIS_URL
by runningwhereexport REDIS_URL="redis://localhost:YOUR_PORT_HERE/"
YOUR_PORT_HERE
is replaced with the port generated in step 3. - Start the Chess Clock Trivia server by running:
gunicorn wsgi:app
Sometimes, an error like ConnectionError: Cannot connect to redis server. Has the redis server been started yet?
may
be shown. In this case, check if the redis server has been started, or check if you have entered the correct port for
the REDIS_URL
.
The rules and protocols for Chess Clock Trivia can be obtained here as a PDF file.
Open this document to see the full list of credits and licenses.