1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-26 10:26:32 +00:00

Compare commits

..

No commits in common. "cf561c4584ccb6fc5c17f412c04e987cc170ea28" and "a853be73c5bbb99f04b9a40f72cef4b6c134e722" have entirely different histories.

11 changed files with 62 additions and 98 deletions

View File

@ -2,24 +2,22 @@ stages:
- test - test
- quality-assurance - quality-assurance
py310:
stage: test
image: python:3.10-alpine
before_script:
- apk add --no-cache libmagic
- pip install tox --no-cache-dir
script: tox -e py310
py311: py311:
stage: test stage: test
image: python:3.11-alpine image: python:3.11-alpine
before_script: before_script:
- apk add --no-cache libmagic - apk add --no-cache libmagic
- apk add --no-cache git # Useful for django-haystack, remove when the newer versions are in PyPI
- pip install tox --no-cache-dir - pip install tox --no-cache-dir
script: tox -e py311 script: tox -e py311
py312:
stage: test
image: python:3.12-alpine
before_script:
- apk add --no-cache libmagic
- apk add --no-cache git # Useful for django-haystack, remove when the newer versions are in PyPI
- pip install tox --no-cache-dir
script: tox -e py312
linters: linters:
stage: quality-assurance stage: quality-assurance
image: python:3-alpine image: python:3-alpine

View File

@ -1,4 +1,4 @@
FROM python:3.12-alpine FROM python:3.11-alpine
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV DJANGO_ALLOW_ASYNC_UNSAFE 1 ENV DJANGO_ALLOW_ASYNC_UNSAFE 1
@ -13,6 +13,8 @@ COPY requirements.txt /code/requirements.txt
COPY docs/requirements.txt /code/docs/requirements.txt COPY docs/requirements.txt /code/docs/requirements.txt
RUN pip install -r requirements.txt --no-cache-dir RUN pip install -r requirements.txt --no-cache-dir
RUN pip install -r docs/requirements.txt --no-cache-dir RUN pip install -r docs/requirements.txt --no-cache-dir
# FIXME Remove this line when all dependencies will be ready
RUN pip install "Django>=4.2,<5.0"
COPY . /code/ COPY . /code/

View File

@ -1,31 +0,0 @@
# Generated by Django 5.0.1 on 2024-01-13 16:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("draw", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="teamdraw",
name="purposed",
field=models.PositiveSmallIntegerField(
choices=[
(1, "Problem #1"),
(2, "Problem #2"),
(3, "Problem #3"),
(4, "Problem #4"),
(5, "Problem #5"),
(6, "Problem #6"),
(7, "Problem #7"),
(8, "Problem #8"),
],
default=None,
null=True,
verbose_name="purposed problem",
),
),
]

View File

@ -4,7 +4,6 @@ crond -l 0
python manage.py migrate python manage.py migrate
python manage.py loaddata initial python manage.py loaddata initial
python manage.py update_index
nginx nginx

View File

@ -17,7 +17,6 @@ from django.utils.translation import gettext_lazy as _
from registration.models import VolunteerRegistration from registration.models import VolunteerRegistration
from tfjm.lists import get_sympa_client from tfjm.lists import get_sympa_client
def get_motivation_letter_filename(instance, filename): def get_motivation_letter_filename(instance, filename):
return f"authorization/motivation_letters/motivation_letter_{instance.trigram}" return f"authorization/motivation_letters/motivation_letter_{instance.trigram}"

View File

@ -7,6 +7,7 @@ from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.management import call_command
from django.test import TestCase from django.test import TestCase
from django.urls import reverse from django.urls import reverse
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
@ -412,18 +413,18 @@ class TestRegistration(TestCase):
""" """
Try to search some things. Try to search some things.
""" """
call_command("rebuild_index", "--noinput", "-v", 0)
response = self.client.get(reverse("haystack_search") + "?q=" + self.user.email + "&models=auth.user") response = self.client.get(reverse("haystack_search") + "?q=" + self.user.email)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTrue(response.context["object_list"]) self.assertTrue(response.context["object_list"])
response = self.client.get(reverse("haystack_search") + "?q=" + response = self.client.get(reverse("haystack_search") + "?q=" +
str(self.coach.registration.professional_activity) str(self.coach.registration.professional_activity))
+ "&models=registration.CoachRegistration")
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTrue(response.context["object_list"]) self.assertTrue(response.context["object_list"])
response = self.client.get(reverse("haystack_search") + "?q=" + response = self.client.get(reverse("haystack_search") + "?q=" +
self.student.registration.school + "&models=registration.StudentRegistration") self.student.registration.get_student_class_display())
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTrue(response.context["object_list"]) self.assertTrue(response.context["object_list"])

View File

@ -1,26 +1,26 @@
channels[daphne]~=4.0.0 channels[daphne]~=4.0.0
channels-redis~=4.2.0 channels-redis~=4.0.0
crispy-bootstrap5~=2023.10 crispy-bootstrap5~=0.7
Django>=5.0,<6.0 Django>=4.1,<5.0
django-crispy-forms~=2.1 django-crispy-forms~=1.14
django-extensions~=3.2.3 django-extensions~=3.2
django-filter~=23.5 django-filter~=22.1
elasticsearch~=7.17.9 django-haystack~=3.2
git+https://github.com/django-haystack/django-haystack.git#v3.3b1 django-mailer~=2.2
django-mailer~=2.3.1 django-phonenumber-field~=7.0
django-phonenumber-field~=7.3.0 django-polymorphic~=3.1
django-polymorphic~=3.1.0 django-tables2~=2.4
django-tables2~=2.7.0 djangorestframework~=3.14
djangorestframework~=3.14.0 django-rest-polymorphic~=0.1
django-rest-polymorphic~=0.1.10 gunicorn~=20.1
gunicorn~=21.2.0
odfpy~=1.4.1 odfpy~=1.4.1
phonenumbers~=8.13.27 phonenumbers~=8.12.57
psycopg2-binary~=2.9.9 psycopg2-binary~=2.9.5
pypdf~=3.17.4 pypdf~=3.4
ipython~=8.20.0 ipython~=8.11.0
python-magic~=0.4.27 python-magic~=0.4.26
requests~=2.31.0 requests~=2.28.1
sympasoap~=1.1 sympasoap~=1.1
uvicorn~=0.25.0 uvicorn~=0.17
websockets~=12.0 websockets~=10.4
whoosh~=2.7

View File

@ -4,6 +4,9 @@
* * * * * cd /code && python manage.py retry_deferred -c 1 * * * * * cd /code && python manage.py retry_deferred -c 1
0 0 * * * cd /code && python manage.py purge_mail_log 7 -c 1 0 0 * * * cd /code && python manage.py purge_mail_log 7 -c 1
# Rebuild search index
0 * * * * cd /code && python manage.py update_index -v 0
# Recreate sympa lists # Recreate sympa lists
*/2 * * * * cd /code && python manage.py fix_sympa_lists &> /dev/null */2 * * * * cd /code && python manage.py fix_sympa_lists &> /dev/null

View File

@ -203,10 +203,13 @@ DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap5.html'
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
'default': { 'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine', 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
} }
} }
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
_db_type = os.getenv('DJANGO_DB_TYPE', 'sqlite').lower() _db_type = os.getenv('DJANGO_DB_TYPE', 'sqlite').lower()
if _db_type == 'mysql' or _db_type.startswith('postgres') or _db_type == 'psql': # pragma: no cover if _db_type == 'mysql' or _db_type.startswith('postgres') or _db_type == 'psql': # pragma: no cover

View File

@ -39,13 +39,3 @@ CHANNEL_LAYERS = {
}, },
}, },
} }
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine',
'URL': 'http://elasticsearch:9200/',
'INDEX_NAME': os.getenv('HAYSTACK_INDEX_NAME', 'inscription-tfjm'),
}
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'

32
tox.ini
View File

@ -1,7 +1,7 @@
[tox] [tox]
envlist = envlist =
py310
py311 py311
py312
linters linters
skipsdist = True skipsdist = True
@ -11,22 +11,22 @@ sitepackages = False
deps = deps =
coverage coverage
channels[daphne]~=4.0.0 channels[daphne]~=4.0.0
crispy-bootstrap5~=2023.10 crispy-bootstrap5~=0.7
Django>=5.0,<6.0 Django>=4.2,<5.0
django-crispy-forms~=2.1 django-crispy-forms~=1.14
django-filter~=23.5 django-filter~=22.1
git+https://github.com/django-haystack/django-haystack.git#v3.3b1 django-haystack~=3.2
django-phonenumber-field~=7.3.0 django-phonenumber-field~=7.0
django-polymorphic~=3.1.0 django-polymorphic~=3.1
django-tables2~=2.7.0 django-tables2~=2.4
djangorestframework~=3.14.0 djangorestframework~=3.14
django-rest-polymorphic~=0.1.10 django-rest-polymorphic~=0.1
odfpy~=1.4.1 odfpy~=1.4.1
phonenumbers~=8.13.27 phonenumbers~=8.12.57
pypdf~=3.17.4 pypdf~=3.4
python-magic~=0.4.27 python-magic~=0.4.26
requests~=2.31.0 requests~=2.28.1
whoosh~=2.7
commands = commands =
coverage run --source=api,draw,logs,participation,registration,tfjm ./manage.py test api/ draw/ logs/ participation/ registration/ tfjm/ coverage run --source=api,draw,logs,participation,registration,tfjm ./manage.py test api/ draw/ logs/ participation/ registration/ tfjm/
coverage report -m coverage report -m