LICENCE: This code is released under the GPL v3 or later
This is a fork of Ben Adida's Helios server. The differences from Helios are as follows:
-
Whereas Helios produces election results, Zeus produces a tally of the ballots cast.
-
This allows Zeus to be used in voting systems other than approval voting (which is supported by Helios), since the vote tally can be fed to any other system that actually produces the election results.
-
In terms of overall architecture and implementation it is closer to the original Helios implementation than Helios v. 3.
Install Postgres (postgres-server
, libpq-dev
).
Install the following libraries:
libgmp-dev libmpfr-dev libmpc-dev
If necessary, create a Postgres user. Then create a database:
sudo -u postgres createuser -s $(whoami)
createdb helios
Ensure you have Python 3.6 and pipenv
installed. You can install pipenv
by running pip install --user pipenv
, but make sure it ends up in your PATH
(e.g. add export PATH=$PATH:$HOME/.local/bin
to your .bashrc
).
Then, do the following:
pipenv --python python3.6
pipenv sync --dev
pipenv shell
This will create a virtualenv for you, install all the required packages (including the ones needed for development) and activate the virtual environment.
Create a local Django settings file. This will be an unversioned file that you can then customize.
cp settings/local_template.py settings/local.py
Run migrations:
python manage.py migrate
Create an institution and admin user:
python manage.py manage_users --create-institution "ZEUS"
python manage.py manage_users --create-user <username> --institution=1 --superuser
python manage.py runserver 0.0.0.0:8000
By default, in development all Celery tasks run synchronously. If you
want to run a Celery worker, first disable this behaviour by editing
settings/local.py
:
CELERY_TASK_ALWAYS_EAGER = False
You need to also install redis
and make sure it's running on
localhost.
Then, run:
celery worker -A zeus.celery -l INFO
pytest -v
We use pipenv to manage dependencies:
Pipfile
- contains a list of direct dependencies, with version specifiersPipfile.lock
- auto-generated fromPipfile
, all packages, all versions pinned together with their checksums
In order to install a new package:
pipenv install <package>
- look into
Pipfile
to make sure the right package was added - test the change and commit all files