GithubHelp home page GithubHelp logo

egc-articuno / decide Goto Github PK

View Code? Open in Web Editor NEW

This project forked from egcetsii/decide_django_2

1.0 1.0 4.0 34.16 MB

Plataforma de voto electrónico educativa

License: GNU Affero General Public License v3.0

Python 56.01% HTML 19.61% JavaScript 21.01% Shell 0.07% Dockerfile 0.16% CSS 0.04% Ruby 0.95% TypeScript 2.14%

decide's Introduction

Build Status Codacy Badge Codacy Badge

Plataforma voto electrónico educativa

El objetivo de este proyecto es implementar una plataforma de voto electrónico seguro, que cumpla una serie de garantías básicas, como la anonimicidad y el secreto del voto.

Se trata de un proyecto educativo, pensado para el estudio de sistemas de votación, por lo que prima la simplicidad por encima de la eficiencia cuando sea posible. Por lo tanto se asumen algunas carencias para permitir que sea entendible y extensible.

Formato de los Commits

<type>(<module>): <subject>

<body>

<footer>

Posibles valores de type:

  • feat (new feature).
  • fix (bug fix).
  • docs (changes to documentation).
  • style (formatting, missing semi colons, etc; no code change).
  • refactor (refactoring production code).
  • test (adding missing tests, refactoring tests; no production -code change).
  • chore (updating grunt tasks etc; no production code change).

En module se incluíran todos los modulos a los que afecte directamente el commit separados por comas. Posibles valores de module:

  • auth -> Autenticación.
  • census -> Censo.
  • voting -> Votación.
  • booth -> Cabina de votación.
  • store -> Almacenamiento de votos (cifrados).
  • mixnet -> Recuento / MixNet.
  • postproc -> Post-procesado.
  • visual -> Visualización de resultados.

En body se inluirá una descipción breve con información útil.

En footer se referirá a las issues creadas en los tableros de github (si procede). Por ejemplo: Closes #234, ó Fix #321.

Todos los commits deben estar escritos enteramente en inglés.

Subsistemas, apps y proyecto base

El proyecto se divide en subsistemas, los cuales estarán desacoplados entre ellos. Para conseguir esto, los subsistemas se conectarán entre si mediante API y necesitamos un proyecto base donde configurar las ruts de estas API.

Este proyecto Django estará dividido en apps (subsistemas y proyecto base), donde cualquier app podrá ser reemplazada individualmente.

Gateway

Para ofrecer un punto de entrada conocido para todos los subsistemas existe el llamado gateway que no es más que una ruta disponible que redirigirá todas las peticiones al subsistema correspondiente, de tal forma que cualquier cliente que use la API no tiene por qué saber en qué servidor está desplegado cada subsistema.

La ruta se compone de:

http://DOMINIO/gateway/SUBSISTEMA/RUTA/EN/EL/SUBSISTEMA

Por ejemplo para acceder al subsistema de autenticación y hacer la petición al endpoint de /authentication/login/ deberíamos hacer la petición a la siguiente ruta:

http://DOMINIO/gateway/authentication/login/

Otro ejemplo sería para obtener una votación por id:

http://DOMINIO/gateway/voting/?id=1

A nivel interno, el módulo mods ofrece esta funcionalidad, pero el gateway es útil para hacer uso desde peticiones de cliente, por ejemplo en el javascript de la cabina de votación o la visualización de resultados, y también para módulos externos que no sean aplicaciones django.

Configurar y ejecutar el proyecto

Para configurar el proyecto, podremos crearnos un fichero local_settings.py basado en el local_settings.example.py, donde podremos configurar la ruta de nuestras apps o escoger que módulos ejecutar.

Una vez hecho esto, será necesario instalar las dependencias del proyecto, las cuales están en el fichero requirements.txt:

pip install -r requirements.txt

Tras esto tendremos que crearnos nuestra base de datos con postgres:

sudo su - postgres
psql -c "create user decide with password 'decide'"
psql -c "create database decide owner decide"

Entramos en la carpeta del proyecto (cd decide) y realizamos la primera migración para preparar la base de datos que utilizaremos:

./manage.py migrate

Por último, ya podremos ejecutar el módulos o módulos seleccionados en la configuración de la siguiente manera:

./manage.py runserver

Ejecutar con docker

Existe una configuración de docker compose que lanza 3 contenedores, uno para el servidor de base de datos, otro para el django y otro con un servidor web nginx para servir los ficheros estáticos y hacer de proxy al servidor django:

  • decide_db
  • decide_web
  • decide_nginx

Además se crean dos volúmenes, uno para los ficheros estáticos y medias del proyecto y otro para la base de datos postgresql, de esta forma los contenedores se pueden destruir sin miedo a perder datos:

  • decide_db
  • decide_static

Se puede editar el fichero docker-settings.py para modificar el settings del proyecto django antes de crear las imágenes del contenedor.

Crear imágenes y lanzar contenedores:

$ cd docker
$ docker-compose up -d

Parar contenedores:

$ docker-compose down

Crear un usuario administrador:

$ docker exec -ti decide_web ./manage.py createsuperuser

Lanzar la consola django:

$ docker exec -ti decide_web ./manage.py shell

Lanzar tests:

$ docker exec -ti decide_web ./manage.py test

Lanzar una consola SQL:

$ docker exec -ti decide_db ash -c "su - postgres -c 'psql postgres'"

Ejecutar con vagrant + ansible

Existe una configuración de vagrant que crea una máquina virtual con todo lo necesario instalado y listo para funcionar. La configuración está en vagrant/Vagrantfile y por defecto utiliza Virtualbox, por lo que para que esto funcione debes tener instalado en tu sistema vagrant y Virtualbox.

Crear la máquina virtual con vagrant:

$ cd vagrant
$ vagrant up

Una vez creada podremos acceder a la web, con el usuario admin/admin:

http://localhost:8080/admin

Acceder por ssh a la máquina:

$ vagrant ssh

Esto nos dará una consola con el usuario vagrant, que tiene permisos de sudo, por lo que podremos acceder al usuario administrador con:

$ sudo su

Parar la máquina virtual:

$ vagrant stop

Una vez parada la máquina podemos volver a lanzarla con vagrant up.

Eliminar la máquina virtual:

$ vagrant destroy

Ansible

El provisionamiento de la aplicación con vagrant está hecho con Ansible, algo que nos permite utilizarlo de forma independiente para provisionar una instalación de Decide en uno o varios servidores remotos con un simple comando.

$ cd vagrant
$ ansible-playbook -i inventory playbook.yml

Para que esto funcione debes definir un fichero inventory con los servidores destino.

Los scripts de ansible están divididos en varios ficheros .yml donde se definen las diferentes tareas, por lo que es posible lanzar partes independientes:

  • packages.yml, dependencias del sistema
  • user.yml, creación de usuario decide
  • python.yml, git clone del repositorio e instalación de dependencias python en virtualenv
  • files.yml, ficheros de configuración, systemd, nginx y local_settings.py
  • database.yml, creación de usuario y base de datos postgres
  • django.yml, comandos django básicos y creación de usuario admin
  • services.yml, reinicio de servicios, decide, nginx y postgres

Por ejemplo este comando sólo reinicia los servicios en el servidor:

$ ansible-playbook -i inventory -t services

El provisionamiento de ansible está diseñado para funcionar con ubuntu/bionic64, para funcionar con otras distribuciones es posible que haga falta modificar el fichero packages.yml.

Versionado

El versionado de API está hecho utilizando Django Rest Framework, y la forma elegida para este versionado es mediante parámetros de búsqueda, podemos cambiarlo a parámetros en la URL o en el nombre del HOST, hay diferentes tipos de versionado disponibles en Django Rest Framework, podemos verlos aqui.

Nosotros hemos escogido el de por parámetros por ser el más sencillo, y hemos creado un ejemplo para que veamos su uso, podemos verlo en voting/views.py

Si nosotros queremos que la salida que nos da la llamada a la API /voting/, sea diferente en la versión 2, solo tenemos que comprobar en la versión nos está llegando, y hacer lo que queramos, por ejemplo:

    def get(self, request, *args, **kwargs):
        version = request.version  # Con request.version obtenemos la versión
        if version not in settings.ALLOWED_VERSIONS:  # Versiones permitidas
            version = settings.DEFAULT_VERSION  # Si no existe: versión por defecto
        # En el caso de usar la versión 2, usamos un serializador diferente
        if version == 'v2':
            self.serializer_class = SimpleVotingSerializer
        return super().get(request, *args, **kwargs)

Para llamar a las diferentes versiones, haremos lo siguiente:

  • /voting/?version=v1
  • /voting/?version=v2

Test de estrés con Locust

Antes de empezar, comentaré para que sirven las pruebas de estrés. A veces necesitamos soportar que nuestra aplicación ofrezca una cantidad de peticiones por segundo, porque habrá mucha gente entrando a la misma vez, y ante este estrés, tenemos que comprobar como se comporta nuestra aplicación.

No es lo mismo que cuando la estresemos nos de un error 500 a que nos devuelva la petición de otro usuario. Con estos test conseguiremos comprobar cual es ese comportamiento, y quizás mejorar la velocidad de las peticiones para permitir más peticiones por segundo.

Para ejecutar los test de estrés utilizando locust, necesitaremos tener instalado locust:

$ pip install locust

Una vez instalado, necesitaremos tener un fichero locustfile.py donde tengamos la configuración de lo que vamos a ejecutar. En nuestro caso, tenemos hecho dos ejemplos:

  1. Visualizer: entra en el visualizador de una votación para ver cuantas peticiones puede aguantar.

    Para ejecutar el test de Visualizer, tenemos que tener en cuenta que entra en la votación 1, por lo que necesitaremos tenerla creada para que funcione correctamente, una vez hecho esto, podemos comenzar a probar con el siguiente comando (dentro de la carpeta loadtest):

     $ locust Visualizer
    

    Esto abrirá un servidor que podremos ver en el navegador, el mismo comando nos dirá el puerto. Cuando se abra, nos preguntará cuantos usuarios queremos que hagan peticiones a la vez, y como queremos que vaya creciendo hasta llegar a ese número. Por ejemplo, si ponemos 100 y 5, estaremos creando 5 nuevos usuarios cada segundo hasta llegar a 100.

  2. Voters: utilizaremos usuarios previamente creados, y haremos una secuencia de peticiones: login, getuser y store. Sería lo que realizaría un usuario cuando va a votar, por lo que con este ejemplo estaremos comprobando cuantas votaciones podemos hacer.

    Para ejecutar el test de Voter, necesitaremos realizar varios preparos. Necesitaremos la votación 1 abierta, y necesitaremos crear una serie de usuarios en el censo de esta votación, para que cuando hagamos el test, estos usuario puedan autenticarse y votar correctamente. Para facilitar esta tarea, hemos creado el script de python gen_census.py, en el cual creamos los usuarios que tenemos dentro del fichero voters.json y los añadimos al censo utilizando la librería requests. Para que este script funcione, necesitaremos tener instalado request:

     $ pip install requests
    

    Una vez instalado, ejecutamos el script:

     $ python gen_census.py
    

    Tras esto, ya podremos comenzar el test de estrés de votantes:

     $ locust Voters
    

Importante mirar bien el fichero locustfile.py, donde existen algunas configuraciones que podremos cambiar, dependiendo del HOST donde queramos hacer las pruebas y del id de la votación.

A tener en cuenta:

  • En un servidor local, con un postgres que por defecto nos viene limitado a 100 usuarios concurrentes, cuando pongamos más de 100, lo normal es que empiecen a fallar muchas peticiones.
  • Si hacemos las pruebas en local, donde tenemos activado el modo debug de Django, lo normal es que las peticiones tarden algo más y consigamos menos RPS (Peticiones por segundo).

decide's People

Contributors

danigm avatar virako avatar daniarcaa avatar josgongon9 avatar robertohermoso avatar martinordonocaro avatar josperdom1 avatar felixvalle97 avatar jesushd103 avatar antonihipona avatar rubendpan avatar claguecue avatar clauuu avatar macarro avatar alvarodelaflor avatar antoniosp7 avatar manueljesus avatar albanb23 avatar chemamf avatar carlosgarciaborrego avatar lh97ivan avatar benavidescuevas avatar javdc avatar

Stargazers

 avatar

Watchers

James Cloos avatar

decide's Issues

[BUG] Error in parity test

Expected Behavior

The test should pass with 0 errors

Current Behavior

Test returns error

Possible Solution

The test must be matched to the expected output to pass it with 0 errors.

Steps to Reproduce

  1. In ubuntu bash, type: ./manage.py test postproc.tests

Detailed Description

The tests.py class of the postproc folder must be modified, specifically the function called test_parity, so that the expected output is the same as the one entered in the test.

Error image

image

[FEATURE] Add or remove people from census

In what module are you working on? Specify
Census.

What is about your new feature? Please describe.
Allow administrators to add or remove people from an existing census.

[BUG] Translation not working with new css

Expected Behavior

The user should be able to select his preferred language correctly

Current Behavior

With the materialize.css sheet, the dropdown menu isn't displayed anymore, only the ¡change' button is.

Possible Solution

  • Remove materialize.css from booth, or
  • Edit the html and/or css of the dropdown menu and surrounding elements to fix the problem

Steps to Reproduce

Open the booth for any voting.

[BUG] The maximum number of presidents is not being calculated.

Expected Behavior

The sum of congress candidates and president candidates must be 350 at most and political parties only can have one president candidates in their list.

Current Behavior

The maximum number of presidential candidates is not being calculated.

Possible Solution

Replicate the method which has been develop for count the maximum of congress candidates.

Steps to Reproduce

Create a new political party. The number of president candidate will not be checked.

[FEATURE] Move people between census

In what module are you working on? Specify
Census.

What is about your new feature? Please describe.
Allow administrators to move people between census.

[FEATURE] Voting data for booth

Change current question model to adapt it to the project scope.

  • A voting can have multiple political parties.
  • A political party can have multiple president candidates.
  • A political party can have multiple congress candidates.

The resulting JSON is provided to @egc-articuno/booth and should follow the same structure as the example provided.

voting.txt

[BUG] pgeocode 404 error

Expected Behavior

The module pgeocode is used to get information about a postal code. This is used several times on the project because it is part of the integration agreement.

Current Behavior

At some point the module pgeocode started to give as a responte to the request a 404 error when the following line is executed:

#nomi = pgeocode.Nominatim('ES')

This line its generic from the module documentation and has no errors in it.
https://pgeocode.readthedocs.io/en/latest/overview.html#quickstart

Possible Solution

-Check the versions of the module.

Steps to Reproduce

This bug will apear when the pgeocode module is executed. Although it has passed the test and should work.
You can also try it by yourself:
https://pgeocode.readthedocs.io/en/latest/overview.html#quickstart

Context (Environment)

This module is going to be used by all the modules, so this error needs to be fixed. I became aware of this bug when commiting an unrelated file to a branch. This was the reason the commit did not pass the travis test.
There is no actual context because it is only related to this module.

Summary:
The module named pgeocode throw a 404 not found error when executing. This is an important problem because it is an important module that has to be functional.

Detailed Description

The first step to be done is check the versions of pgeocode.

[FEATURE] Clone/Reuse Census

In what module are you working on? Specify
Census.

What is about your new feature? Please describe.
Allow administrators to clone or reuse an existing census.

[Feature] Minimal homepage

In which module are you working on? Specify
This issue does not involve any particular module

What is about your new feature? Please describe.
Currently the application does not have a home page.
It is necessary to implement a home page with at least the ability to login to the administration dashboard.

[FEATURE] Telegram bot

In what module are you working on? Specify
Booth

What is about your new feature? Please describe.
Making the app more accessible and giving the user more options is always a good idea. That's why I decided to create a Telegram bot where users can vote without leaving their favorite messaging app. For this, I'm going to use Python and the Python Telegram Bot library.

Describe the solution you'd like
The Telegram bot should be able to show all the active votings and also insert a voting URL. After logging in, the user could pick an option to vote and send it, all without leaving the bot

Describe alternatives you've considered
A Telegram bot can be developed using almost any programming language in existence, because Telegram uses a simple API that anyone can contact. I decided to use Python because it's the language used in the rest of the project and I feel comfortable programming in it. There are two primary libraries to develop a Telegram bot: Telebot and Python Telegram Bot. I decided to use the second one because it is more complete and has very good documentation and examples.

[FEATURE] Let user manually select the language of the booth

In what module are you working on? Specify
Booth

What is about your new feature? Please describe.
Currently, the language of the booth is chosen according to the Accept-Language HTTP header ie. the language set in the user's browser or operating system. The user cannot choose to change his language preference (unless he change his browser or os settings).

Describe the solution you'd like
The new feature would consist in a dropdown menu that allows the user to select his preferred language.

Describe alternatives you've considered
None.

Additional context
Related to issue #19.

[BUG] Language selection dropdown menu not showing correctly

After materialize.css was added to the voting booth, the dropdown menu to select the language wasn't showing anymore. This issue (#57) is already fixed but the text inside the menu is aligned to the top right corner.

Expected behavior: The text should be aligned to le bottom left corner as in the default style of materialize.css.

[FEATURE] Export CSV

In what module are you working on? Specify
Census.

What is about your new feature? Please describe.
Allow administrators to export census data to a .csv file.

[FEATURE] Women/men balance in political parties

The following checks must be made when a political party is created:

  • The number of women candidates must be at least a 40% of the total candidates.
  • The number of men candidates must be at least a 40% of the total candidates.

[FEATURE] D'hondt law

NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at StackOverflow

PostProc

Develop a functionality that implements the D'hondt law in the vote count.

A higher average method should be developed for allocating seats in proportional representation systems by electoral lists.

[BUG] Request timeout when trying to vote on heroku

Expected Behavior

A user should be able to vote using the booth interface.

Current Behavior

The application work as expected when executed on any local machine. It does not work when executed on the application deployed on heroku.

Possible Solution

The problem is probably related to an incompatibility between the algorithm used to encrypt the votes and the low performance of the free heroku server. Possible solutions could there be to either

  • change the encryption algorithm to one that executes quicker
  • upgrade the server to one that offers more performance

Steps to Reproduce

  1. Deploy decide on heroku
  2. Make sure that a voting and a user that has access to that voting exist
  3. Log in as that user to the booth of the voting
  4. Try to vote. After approximately 10 seconds you will see the following message:
    Captura de pantalla 2019-12-11 a las 18 34 11

Context (Environment)

The issue makes it impossible to vote if the application is deployed on heroku.

Detailed Description

A user is not able to vote in the booth when the application is executed while deployed on heroku. The problem is probably related to an incompatibility between the algorithm used to encrypt the votes and the low performance of the free heroku server.

Log that shows the issue: request-timeout-log.txt. Obtained by executing heroku logs --tail while reproducing the issue according to the four steps mentioned above.

First a decision has to taken on how to solve the issue. The easiest way seems to be changing the encryption algorithm.

[FEATURE] Voter age

NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at StackOverflow

PostProc

This method will perform a weighting according to the age range in which the voter is.

The method must return the number of votes after treatment with the new weighting.

[FEATURE] Angular booth: Only show the components that are necessary at each moment

Current behavior: In the angular booth, the 3 components (voting-list, login, and voting-form) are always displayed.

Expected behavior: When no user is logged in, only the login component should be visible and the other two should be hidden. After a user logs in correctly, the login component should be hidden and the other two components should be displayed.

Related to issue #17.

[FEATURE]Angular UI

Booth

The booth interface based on vue is very basic and aesthetic for users.

I will provide an angular app to make prettier and easier the process of voting.

I have consider several options like use ReactJS library, but finallly my choice will be angular since is the most powerful singlepage forntend famework at the moment.

[FEATURE] Weighting by gender

NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at StackOverflow

PostProc

This method should weight the votes depending on the gender of the voter.

Must return the votes after the calculation with the new weighting.

[Feature] Display user's province

In what module are you working on? Specify
Booth

What is about your new feature? Please describe.
Display user's province in the booth according to his/her zip code.

Additional context
This issue is related to #5 and #37

[FEATURE] Gender parity for candidates

NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at StackOverflow

PostProc

This method applies parity for creating a ratio between men and women.

The method will return the list of candidates, from which groups of five candidates (60/40) are going to be taken and ordered successively.

[Feature] Blank vote

In what module are you working on? Specify
Booth.

What is about your new feature? Please describe.
Allow users to send a blank vote.

Additional context
This issue is related to #14

[FEATURE] Blank vote option

Add a "Blank vote" option by default in the voting module.

Adds data to JSON (GET Response).
Received by: @egc-articuno/booth

Integrate Voting angular model

Since model of voting has been updated by 'Voting' module, angular models for votings, questions, etc must be updated to create de objects when deserializing.

Correct spelling mistakes in booth UI

Expected Behavior

There should be no spelling mistakes in the booth UI.

Current Behavior

There is at least one spelling mistake: When sending a vote, a message appears which includes the word "Conglatulations"

Possible Solution

Correct the spelling in booth.html.

Steps to Reproduce

  1. Enter into a voting in the booth
  2. Vote correctly
  3. A message appears that says: "Conglatulations. Your vote has been sent"

Detailed Description

Proposed change: Change "Conglatulations" to "Congratulations"

[Feature] Update booth regarding voting update

In what module are you working on? Specify
Booth

What is about your new feature? Please describe.
Update the booth to implement the following enhancements:

  • A voting can have multiple political parties.
  • A political party can have multiple president candidates.
  • A political party can have multiple congress candidates.

Additional context
This issue is related to #21

[FEATURE] Translate booth to Catalan, Basque and Galician

Module: booth

Current behavior: The booth is only available in English and Spanish

Requested behavior: Since the system is going to be used in the context of national elections, the booth should be available in Catalan, Basque and Galician as well.

Related to #19

[FEATURE] Internationalization of booth

Booth

The system generated messages of the booth should be translated to the user's language. In addition to English, at least Spanish should be available.

The best way to implement this is probably Django's integrated translation mechanism (documentation).

The proposed solution seems pretty straightforward because it is already partially implemented. Therefore I have not considered any alternative solutions.

[BUG] ConnectionError when trying to login in the Heroku administrator dashboard

Expected Behavior

Login works and I am redirected to the dashboard

Current Behavior

This error is shown when logging in:
Captura de pantalla de 2019-12-11 11-32-48

Steps to Reproduce

  1. Go to the Heroku app (decide-articuno.herokuapp.com)
  2. Try to log in with correct credentials
  3. This error is shown

Context (Environment)

The same error is shown with different browsers. Tried with Firefox 70.0.1 and Chromium 78. When logging in with wrong credentials, a normal error is shown.

Detailed Description

This is the complete stack trace of the error:

Environment:


Request Method: POST
Request URL: https://decide-articuno.herokuapp.com/admin/login/

Django Version: 2.0
Python Version: 3.6.9
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'corsheaders',
 'django_filters',
 'rest_framework',
 'rest_framework.authtoken',
 'rest_framework_swagger',
 'gateway',
 'authentication',
 'base',
 'booth',
 'census',
 'mixnet',
 'postproc',
 'store',
 'visualizer',
 'voting']
Installed Middleware:
('whitenoise.middleware.WhiteNoiseMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')



Traceback:

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connection.py" in _new_conn
  141.                 (self.host, self.port), self.timeout, **extra_kw)

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/util/connection.py" in create_connection
  83.         raise err

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/util/connection.py" in create_connection
  73.             sock.connect(sa)

During handling of the above exception ([Errno 111] Connection refused), another exception occurred:

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connectionpool.py" in urlopen
  601.                                                   chunked=chunked)

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connectionpool.py" in _make_request
  357.             conn.request(method, url, **httplib_request_kw)

File "/app/.heroku/python/lib/python3.6/http/client.py" in request
  1254.         self._send_request(method, url, body, headers, encode_chunked)

File "/app/.heroku/python/lib/python3.6/http/client.py" in _send_request
  1300.         self.endheaders(body, encode_chunked=encode_chunked)

File "/app/.heroku/python/lib/python3.6/http/client.py" in endheaders
  1249.         self._send_output(message_body, encode_chunked=encode_chunked)

File "/app/.heroku/python/lib/python3.6/http/client.py" in _send_output
  1036.         self.send(msg)

File "/app/.heroku/python/lib/python3.6/http/client.py" in send
  974.                 self.connect()

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connection.py" in connect
  166.         conn = self._new_conn()

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connection.py" in _new_conn
  150.                 self, "Failed to establish a new connection: %s" % e)

During handling of the above exception (<urllib3.connection.HTTPConnection object at 0x7f4b5db6bd68>: Failed to establish a new connection: [Errno 111] Connection refused), another exception occurred:

File "/app/.heroku/python/lib/python3.6/site-packages/requests/adapters.py" in send
  440.                     timeout=timeout

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/connectionpool.py" in urlopen
  639.                                         _stacktrace=sys.exc_info()[2])

File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/util/retry.py" in increment
  388.             raise MaxRetryError(_pool, url, error or ResponseError(cause))

During handling of the above exception (HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /authentication/login/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b5db6bd68>: Failed to establish a new connection: [Errno 111] Connection refused',))), another exception occurred:

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  35.             response = get_response(request)

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  128.                 response = self.process_exception_by_middleware(e, request)

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/admin/sites.py" in login
  398.         return LoginView.as_view(**defaults)(request)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  62.             return bound_func(*args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
  76.             return view(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  58.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  62.             return bound_func(*args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  58.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  62.             return bound_func(*args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  58.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/auth/views.py" in dispatch
  65.         return super().dispatch(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
  89.         return handler(request, *args, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/django/views/generic/edit.py" in post
  141.         if form.is_valid():

File "/app/.heroku/python/lib/python3.6/site-packages/django/forms/forms.py" in is_valid
  179.         return self.is_bound and not self.errors

File "/app/.heroku/python/lib/python3.6/site-packages/django/forms/forms.py" in errors
  174.             self.full_clean()

File "/app/.heroku/python/lib/python3.6/site-packages/django/forms/forms.py" in full_clean
  377.         self._clean_form()

File "/app/.heroku/python/lib/python3.6/site-packages/django/forms/forms.py" in _clean_form
  404.             cleaned_data = self.clean()

File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/auth/forms.py" in clean
  195.             self.user_cache = authenticate(self.request, username=username, password=password)

File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in authenticate
  70.             user = _authenticate_with_backend(backend, backend_path, request, credentials)

File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in _authenticate_with_backend
  115.     return backend.authenticate(*args, **credentials)

File "/app/decide/base/backends.py" in authenticate
  26.             token = mods.post('authentication', entry_point='/login/', json=data)

File "/app/decide/base/mods.py" in post
  66.     return query(*args, method='post', **kwargs)

File "/app/decide/base/mods.py" in query
  53.         response = q(url, json=json_data, headers=headers)

File "/app/.heroku/python/lib/python3.6/site-packages/requests/api.py" in post
  112.     return request('post', url, data=data, json=json, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/requests/api.py" in request
  58.         return session.request(method=method, url=url, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/requests/sessions.py" in request
  508.         resp = self.send(prep, **send_kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/requests/sessions.py" in send
  618.         r = adapter.send(request, **kwargs)

File "/app/.heroku/python/lib/python3.6/site-packages/requests/adapters.py" in send
  508.             raise ConnectionError(e, request=request)

Exception Type: ConnectionError at /admin/login/
Exception Value: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /authentication/login/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b5db6bd68>: Failed to establish a new connection: [Errno 111] Connection refused',))

[FEATURE] Import CSV

In what module are you working on? Specify
Census.

What is about your new feature? Please describe.
Allow administrators to import census data from a .csv file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.