Election results data entry and verification software built by Ona Systems, commissioned by the Libyan High National Elections Commission and UNDP.
git clone [email protected]:onaio/tally-ho.git
Prerequisites: Ensure virtualenvwrapper and PostgreSQL are installed.
mkvirtualenv tally --python=python3.9
pip install -r requirements/dev.pip
Install libpq-dev
for PostgreSQL headers:
sudo apt-get install libpq-dev
Install memcached and Redis:
sudo apt-get update && sudo apt-get install -y memcached redis-server
Ensure latest versions of pip, wheel, and setuptools:
python -m pip install -U pip wheel setuptools
Enable pre-commit hook checks:
pre-commit install
celery -A tally_ho.celeryapp worker --loglevel=info
Warning: This will erase all database data.
./scripts/quick_start
If server setup is complete, start the server:
python manage.py runserver --settings=tally_ho.settings.dev
Note: Add demo result forms and candidate lists.
Warning: This erases all database data and only works with files in
./data
.
./scripts/reload_all postgres 127.0.0.1 tally_ho.settings.common
With Docker and docker-compose
installed, build and run:
docker-compose build
docker-compose up
Visit 127.0.0.1:8000
. For production, modify the docker-compose.yml
file:
- Change NGINX port from 8000 to 80.
- Add your host to
ALLOWED_HOSTS
intally_ho/settings/docker.py
.
Run tests with:
pytest tally_ho
Follow these steps for managing Arabic translations:
-
Add Arabic Language: Update
settings.py
:# settings.py LANGUAGES = [ ('en', 'English'), ('ar', 'Arabic'), ] # Ensure LANGUAGE_CODE is set to a default language (e.g., 'en') LANGUAGE_CODE = 'en'
-
Generate Arabic Translation Files:
django-admin makemessages -l ar
-
Edit Arabic Translations: Update
locale/ar/LC_MESSAGES/django.po
. -
Compile Translations:
django-admin compilemessages
Install requirements from requirements/dev.pip
and graphviz.
Generate all model graphs:
python manage.py graph_models --settings=tally_ho.settings.dev --pydot -a -g -o tally-ho-all-models.png
Generate specific app model graphs:
python manage.py graph_models --settings=tally_ho.settings.dev --pydot -a -X GroupObjectPermission,... -g -o tally-ho-app-models.png
Use the create_demo_users
command to create demo users with usernames like super_administrator
, and password data
.
File upload limit is set to 10MB in MAX_FILE_UPLOAD_SIZE
within tally_ho/settings/common.py
.
- Article: Writing Python Code to Decide an Election.
- PyConZA 2014 presentation: Writing Python Code to Decide an Election.