antoinealb / swiss-unity-league

Source code of unityleague.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity League Ranking website

Running the code locally

First, you need to install the dependencies. The example below shows how to do that in a virtual environment, which is recommended to isolate your development environment from your system.

Installing dependencies

python3 -m venv env
env/bin/pip install -r requirements.txt

this is only needed once, however, when working with the code, make sure that your virtual environment is correctly activated with the following command:

# Start the dev environment with the modules you installed above
# This must be run in every shell you want to work in.
source /env/bin/activate

Running the unit tests

./manage.py test --exclude-tag=latex

Note that here we are removing the tests that include Latex (PDF generator), as generating PDF is quite slow. If you are testing invoice generation, you can ommit --exclude-tag from your command.

Creating the database

The next step is to create the database, and to apply any pending migrations.

./manage.py migrate

Creating an admin user

./manage.py createsuperuser

You might then want to create a Tournament Organizer profile for the superuser by going to the admin panel once your website is running.

Generating fake data

This command just generates a few fake tournaments, with fake players and fake TOs for testing the website without having access to the real database.

./manage.py generatedata

Running the dev server

./manage.py runserver

Setting up pre-commit hooks

  1. First, install pre-commit, you can do it with pip install pre-commit or use your package manager.
  2. Then, run pre-commit install
  3. Now, everytime you run git commit, code formatting will be enforced and fixed automatically.

About

Source code of unityleague.ch

License:Apache License 2.0


Languages

Language:HTML 42.7%Language:Python 38.7%Language:SCSS 18.1%Language:JavaScript 0.2%Language:TeX 0.2%Language:Dockerfile 0.0%Language:Shell 0.0%