Election results data entry and verification software built by Ona Systems, commissioned by the Libyan High National Elections Commission and UNDP.
git clone git@github.com:onaio/tally-ho.gitPrerequisites: Ensure virtualenvwrapper and PostgreSQL are installed.
mkvirtualenv tally --python=python3.9
pip install -r requirements/dev.pipInstall libpq-dev for PostgreSQL headers:
sudo apt-get install libpq-devInstall memcached and Redis:
sudo apt-get update && sudo apt-get install -y memcached redis-serverEnsure latest versions of pip, wheel, and setuptools:
python -m pip install -U pip wheel setuptoolsEnable pre-commit hook checks:
pre-commit installcelery -A tally_ho.celeryapp worker --loglevel=infoWarning: This will erase all database data.
./scripts/quick_startIf server setup is complete, start the server:
python manage.py runserver --settings=tally_ho.settings.devNote: 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.commonWith Docker and docker-compose installed, build and run:
docker-compose build
docker-compose upVisit 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_HOSTSintally_ho/settings/docker.py.
Run tests with:
pytest tally_hoFollow 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.pngGenerate specific app model graphs:
python manage.py graph_models --settings=tally_ho.settings.dev --pydot -a -X GroupObjectPermission,... -g -o tally-ho-app-models.pngUse 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.