Election results data entry and verification software built by Ona Systems and commissioned by the Libyan High National Elections Commission and the United Nations Development Program.
git clone git@github.com:onaio/tally-ho.git
Prerequisites: this assumes you have virtualenvwrapper and PostgreSQL installed.
mkvirtualenv tally --python=python3.9
pip install -r requirements/dev.pip
Install libpq-dev
library that contains a minimal set of PostgreSQL
binaries and headers requried
for building 3rd-party applications for PostgreSQL
.
sudo apt-get install libpq-dev
Install memcache
sudo apt-get update && sudo apt-get install -y memcached
Install redis
sudo apt-get install -y redis-server
Make sure you have the latest versions of pip, wheel, and setuptools installed, run
python -m pip install -U pip wheel setuptools
To Enable pre-commit hook checks for development, in your virtual env, run
pre-commit install
celery -A tally_ho.celeryapp worker --loglevel=info
This will remove all data in the database.
To create the database, load demo users, and start the server all in one, run
./scripts/quick_start
If you've aleady setup the server, you can start the server with
python manage.py runserver --settings=tally_ho.settings.dev
TODO: add some demo result forms and candidate lists
This will remove all data in the database.
This will only work if you have data files in the folder
./data
The first argument is the database user, the second is the database host IP address, and the third is the settings file. Modify these arguments as needed.
./scripts/reload_all postgres 127.0.0.1 tally_ho.settings.common
If you already have Docker and docker-compose
installed on your machine you can quickly have a demo up by changing into the checked out code directory and running:
docker-compose build
docker-compose up
You can now visit the site at 127.0.0.1:8000
.
If you want to use Docker to run the site in production you will need to:
docker-compose.yml
file to change the NGINX listening port from 8000 to 80,ALLOWED_HOSTS
list in the tally_ho/settings/docker.py
file.run pytest tally_ho
The below assumes you have pip
installed requirements/dev.pip
and graphviz in your machine.
Generate model graph for all models:
python manage.py graph_models --settings=tally_ho.settings.dev --pydot -a -g -o tally-ho-all-models.png
Generate model graph for app models:
python manage.py graph_models --settings=tally_ho.settings.dev --pydot -a -X GroupObjectPermission,UserObjectPermission,GroupObjectPermissionBase,BaseGenericObjectPermission,UserObjectPermissionBase,BaseObjectPermission,Version,Revision,Pageview,Visitor,Session,AbstractBaseSession,Site,LogEntry,User,Group,AbstractUser,Permission,ContentType,AbstractBaseUser,PermissionsMixin,BaseModel -g -o tally-ho-app-models.png
The create_demo_users
command will create demo users for each role with usernames like super_administrator
, and password data
.
The MAX_FILE_UPLOAD_SIZE
variable in tally_ho/settings/common.py
file defines the file upload limit which is currently set to 10MB.