This repository holds the code for wikispeedruns.com.
- Python 3.7 or greater
- MySQL Server 8 Download here
We recommend creating a Python virtual environment for running the server.
python -m venv env
For Windows Powershell:
./env/Scripts/Activate.ps1
For Linux
source env/bin/activate
Then install the requirements (with your virtual environment activated)
pip install -r requirements.txt
There are a number of scripts to help setup the web app in scripts.
Once the MySQL server is running, you will need to create an account. By
default we assume an account user
with no password (see
default.json
). If you wish to use a different MySQL
setup, you can create prod.json
with the relevant MySQL fields in
config
which will override default.json
.
Then create the database and tables using the provided script.
cd scripts
python create_db.py
There is also an interactive script (with instructions in the scripts) which
can be used to set up a local admin account. Through the admin account,
prompts can be managed through /manage
.
cd scripts
python create_admin_account.py
Set the environment variable FLASK_ENV
in whaterver command prompt you use plan to use
for running the flask server. This will allow the local instance to reload automatically
when files are changed.
For example, in Linux
export FLASK_ENV="development"
Or in Windows Powershell
$env:FLASK_ENV="development"
From the top level directory
flask run
In order to run the tests locally, you need to create another account in MYSQL
with username testuser
and password testpassword
. Our tests are configured to run
against this account by default.
Then, simply run pytest from the test
directory.
cd test
pytest
Note that these tests are also run in Docker upon making a PR using Github workflows. In the future we may setup docker to run tests as well.