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.
Important
This is only needed once, however, when working with the code, make sure that your virtual environment is correctly activated with the following commands.
You will need to install GDAL and GEOS in order to have the IP-based geolocation work correctly. If you don't have those libraries installed, a dummy location will be returned instead.
See the Django documentation on how to install those libraries in general. On a mac, you can get them with:
$ brew install gdal geos
python3 -m venv env
env/bin/pip install -r requirements.txt
# 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
./manage.py test --exclude-tag=latex
Tip
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.
The next step is to create the database, and to apply any pending migrations.
./manage.py migrate
./manage.py createsuperuser
Important
As this superuser does not have an associated Event Organizer profile, you will not be able to use it for testing event creation & uploading of results. To do so, create an Event Organizer profile in the admin panel and attach it to the newly created superuser.
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
./manage.py runserver
- First, install pre-commit, you can do it with
pip install pre-commit
or use your package manager. - Then, run
pre-commit install
- Now, everytime you run
git commit
, code formatting will be enforced and fixed automatically.