Skip to content

nicorikken/freedomvote

 
 

Repository files navigation

Freedomvote

A tool to represent the views of politicans as a help to the voters. freedomvote.ch

Installation

The "hard" way

Requirements:

  • python 2.7
  • postgresql
  • python-pip

Run pip install -r requirements.txt to install all requirements.

Configure your DB settings in app/settings.ini:

[DB]
NAME = freedomvote
USER = freedomvote
PASS = ***********
PORT = 5432
HOST = 127.0.0.1

and then run:

$ psql -h <db_host> -U <db_user> <db_name> < tools/docker/cache_table.sql
$ python app/manage.py migrate
$ python app/manage.py createsuperuser
$ python app/manage.py runserver

Now you can access the frontend on http://localhost:8000

Postgresql on Debian

sudo apt install postgresql postgresql-client

$ sudo -u postgres bash
$ cd /
$ createuser freedomvote -P -d -g postgres
$ createdb -O postgres freedomvote

The easy way - Docker

To run Freedomvote in a docker container, you need to install docker and docker-compose and execute those commands:

$ make docker-init docker

Default user is admin with password 123qwe, to change this, run make docker-pw

Now you can access the frontend on http://localhost:8000

Django management

Django already provides a number of management commands out of the box. Other parts of this document already lists the usages of some of these commands. Freedomvote provides a couple of custom commands to ease the setup process:

$ python app/manage.py help
$ python app/manage.py help <command>
$ python app/manage.py generate_politicians 42
$ python app/manage.py politician_import politician_import.csv.example
$ python app/manage.py user_import user_import.csv.example

LinkType icons

In the management dashboard custom LinkTypes can be configured with both name and icon. A fixture is included with this repository to help you configure a common set of link types easily. Note that if some of these LinkTypes already exist, triggering this command will add the new ones regardless of existing LinkTypes.

$ python app/manage.py loaddata fixtures/linktypes.json

This common set of icon was gathered from fontawesome using icon_font_to_png.

Languages

The whole application is multilingual. Per default the languages German, Italian and French are installed. The translation are located in app/locale/<lang_code>/LC_MESSAGES/django.po. After editing the translation, run python manage.py compilemessages

To install another language (English in this example) make the following steps:

app/freedomvote/settings.py

LANGUAGES = (
  ...
  ...
  ('en', _('english')),
)

then create a new folder for the language:

$ mkdir app/locale/en

now run those commands in your environment:

$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py makemessages
$ python manage.py compilemessages

or with docker:

$ make docker-makemigrations
$ make docker-migrate
$ make docker-makemessages
$ make docker-compilemessages

License

GPLv3 see LICENSE

About

A tool to represent the views of politicians as a help to the voters.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 47.8%
  • HTML 25.3%
  • CSS 18.7%
  • JavaScript 6.5%
  • Makefile 1.7%