Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 2.02 KB

README.md

File metadata and controls

70 lines (51 loc) · 2.02 KB
logo

Valgret API

Valgret is an open-source project that implements the Schulze method of voting complete with a user interface and database. It was created for organizations of any size to provide tools for internal decision-making, public polling and transparency.

This module was written with FastAPI using an asynchronous postgresql database. The complementary front end code can be found in this repository.

Installation

Valgret uses poetry for dependency management.

Clone the repository and run:

poetry install

to install required dependencies. Afterwards, create an .env file containing:

SQLALCHEMY_DATABASE_URI = "postgresql+asyncpg://user:password@postgresserver/db"

Modify the connection string for your own database server.

Docker container example:

For a postgresql docker image that was created with these settings:

docker run -d --name postgres -e POSTGRES_PASSWORD=admin -v ${HOME}/Desktop/postgres-data/:/var/lib/postgresql/data -p 5432:5432 postgres

the .env file will be

SQLALCHEMY_DATABASE_URI = "postgresql+asyncpg://postgres:admin@localhost/postgres"

Valgret uses alembic to manage migrations.

alembic revision
alembic upgrade head

You can run the app with:

uvicorn votingapp.main:app --reload

Afterwards you can check localhost:8000/docs for interactive API docs and more info.

Usage

For a full list of features and how to access them please refer to the documentation.

Tests

Activate the virtual environment if you're not in it

poetry shell

and make sure a database server is running. To run the tests:

pytest

Contributing

Pull requests are welcome.

License

GPL-3.0