Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
build:
strategy:
matrix:
pyversion: ['3.8','3.9']
pyversion: ['3.12']

runs-on: ubuntu-latest

services:
postgres:
image: postgres:11.18-bullseye
image: postgres:14-bullseye
env:
POSTGRES_USER: decide
POSTGRES_PASSWORD: decide
Expand Down
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/wadobo/decide.svg?branch=master)](https://travis-ci.com/wadobo/decide) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/6a6e89e141b14761a19288a6b28db474)](https://www.codacy.com/gh/decide-update-4-1/decide-update-4.1/dashboard?utm_source=github.com&utm_medium=referral&utm_content=decide-update-4-1/decide-update-4.1&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/6a6e89e141b14761a19288a6b28db474)](https://www.codacy.com/gh/decide-update-4-1/decide-update-4.1/dashboard?utm_source=github.com&utm_medium=referral&utm_content=decide-update-4-1/decide-update-4.1&utm_campaign=Badge_Coverage)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6a6e89e141b14761a19288a6b28db474)](https://www.codacy.com/gh/decide-update-4-1/decide-update-4.1/dashboard?utm_source=github.com&utm_medium=referral&utm_content=decide-update-4-1/decide-update-4.1&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/6a6e89e141b14761a19288a6b28db474)](https://www.codacy.com/gh/decide-update-4-1/decide-update-4.1/dashboard?utm_source=github.com&utm_medium=referral&utm_content=decide-update-4-1/decide-update-4.1&utm_campaign=Badge_Coverage)

Plataforma voto electrónico educativa
=====================================
Expand Down Expand Up @@ -222,7 +222,7 @@ 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\_db (PostgreSQL 14 con pgautoupgrade)
* decide\_web
* decide\_nginx

Expand All @@ -233,6 +233,11 @@ contenedores se pueden destruir sin miedo a perder datos:
* decide\_db
* decide\_static

**Nota sobre la actualización de PostgreSQL:** Si vienes de una versión anterior con
PostgreSQL 11, la imagen `pgautoupgrade` se encargará de migrar automáticamente los
datos al formato de PostgreSQL 14 en el primer arranque. Este proceso puede tardar
unos minutos dependiendo del tamaño de la base de datos.

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

Expand Down Expand Up @@ -261,8 +266,12 @@ Lanzar una consola SQL:

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

Ejecutar con vagrant + ansible
------------------------------
Ejecutar con vagrant + ansible (DEPRECATED)
--------------------------------------------

> **DEPRECATED:** La configuración de Vagrant usa `ubuntu/bionic64` (Ubuntu 18.04 EOL) con
> Python 3.6, que es incompatible con la versión actual del proyecto (Python 3.12+).
> Se recomienda usar Docker en su lugar.

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
Expand Down Expand Up @@ -463,31 +472,31 @@ Si se quieren añadir más casuística a la carga inicial, basta con editar el "
la misma estructura que los datos contenidos en el mismo.


Cabe añadir que previo a ejecutar ambos comandos, deberemos haber activado nuestro entorno de
Python 3.9.
Cabe añadir que previo a ejecutar ambos comandos, deberemos haber activado nuestro entorno de
Python 3.12.


El archivo "populate.json" se ha generado manualmente con ayuda de la documentación encontrada en
[el siguiente portal web](https://docs.djangoproject.com/en/4.1/howto/initial-data/).
[el siguiente portal web](https://docs.djangoproject.com/en/5.2/howto/initial-data/).

Versiones actuales
------------------

En las ultimas actualizaciones se han modificado las versiones usadas por la aplicación Decide. Las
En las ultimas actualizaciones se han modificado las versiones usadas por la aplicación Decide. Las
versiones usadas actualmente se corresponden a las siguientes:

* Django = 4.1
* Django = 5.2
* pycryptodome = 3.15.0
* djangorestframework = 3.14.0
* django-cors-headers = 3.13.0
* requests = 2.28.1
* django-filter = 22.1
* psycopg2 = 2.9.4
* coverage = 6.5.0
* jsonnet = 0.18.0
* django-nose = 1.4.6
* django-rest-swagger = 2.2.0
* Python = 3.9
* Vue=3
* Bootstrap=5.2
* selenium = 4.7.2
* djangorestframework = 3.15.2
* django-cors-headers = 4.6.0
* requests = 2.32.3
* django-filter = 24.3
* psycopg2 = 2.9.10
* coverage = 7.6.10
* jsonnet = 0.20.0
* drf-spectacular = 0.29.0
* Python = 3.12
* Vue = 3
* Bootstrap = 5.2
* selenium = 4.27.1
* PostgreSQL >= 14
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.2 on 2026-02-11 17:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('census', '0001_initial'),
]

operations = [
migrations.AlterUniqueTogether(
name='census',
unique_together=set(),
),
migrations.AddConstraint(
model_name='census',
constraint=models.UniqueConstraint(fields=('voting_id', 'voter_id'), name='unique_voting_voter'),
),
]
4 changes: 3 additions & 1 deletion decide/census/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ class Census(models.Model):
voter_id = models.PositiveIntegerField()

class Meta:
unique_together = (('voting_id', 'voter_id'),)
constraints = [
models.UniqueConstraint(fields=['voting_id', 'voter_id'], name='unique_voting_voter'),
]
16 changes: 10 additions & 6 deletions decide/decide/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'django_filters',
'rest_framework',
'rest_framework.authtoken',
'rest_framework_swagger',
'drf_spectacular',
'gateway',
]

Expand All @@ -51,7 +51,15 @@
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.QueryParameterVersioning'
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.QueryParameterVersioning',
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

SPECTACULAR_SETTINGS = {
'TITLE': 'Decide API',
'DESCRIPTION': 'Plataforma de voto electrónico educativa',
'VERSION': '1.0.0',
'SERVE_INCLUDE_SCHEMA': False,
}

AUTHENTICATION_BACKENDS = [
Expand Down Expand Up @@ -146,13 +154,9 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

Expand Down
8 changes: 3 additions & 5 deletions decide/decide/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from rest_framework_swagger.views import get_swagger_view


schema_view = get_swagger_view(title='Decide API')
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView

urlpatterns = [
path('admin/', admin.site.urls),
path('doc/', schema_view),
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('doc/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('gateway/', include('gateway.urls')),
]

Expand Down
11 changes: 4 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from python:3.9-alpine
from python:3.12-alpine

RUN apk add --no-cache git postgresql-dev gcc libc-dev
RUN apk add --no-cache gcc g++ make libffi-dev python3-dev build-base
RUN apk add --no-cache postgresql-dev gcc libc-dev gcc g++ make libffi-dev python3-dev build-base

RUN pip install gunicorn
RUN pip install psycopg2
RUN pip install ipdb
RUN pip install ipython
RUN pip install --upgrade pip==26.0.1
RUN pip install gunicorn==25.0.3

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
db:
restart: always
container_name: decide_db
image: postgres:11.18-bullseye
image: pgautoupgrade/pgautoupgrade:14-alpine3.21
volumes:
- db:/var/lib/postgresql/data
networks:
Expand All @@ -16,7 +16,7 @@ services:
container_name: decide_web
image: decide_web:latest
build: .
command: ash -c "python manage.py migrate && gunicorn -w 5 decide.wsgi --timeout=500 -b 0.0.0.0:5000"
command: ash -c "python manage.py collectstatic --noinput --clear && python manage.py migrate && gunicorn -w 5 decide.wsgi --timeout=500 -b 0.0.0.0:5000"
expose:
- "5000"
volumes:
Expand Down
21 changes: 10 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Django==4.1
Django==5.2
pycryptodome==3.15.0
djangorestframework==3.14.0
django-cors-headers==3.13.0
requests==2.28.1
django-filter==22.1
psycopg2==2.9.4
coverage==6.5.0
jsonnet==0.18.0
django-nose==1.4.6
django-rest-swagger==2.2.0
selenium==4.7.2
djangorestframework==3.15.2
django-cors-headers==4.6.0
requests==2.32.3
django-filter==24.3
psycopg2==2.9.10
coverage==7.6.10
jsonnet==0.20.0
drf-spectacular==0.29.0
selenium==4.27.1