1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-12 09:41:18 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Yohann D'ANELLO
0fe1f9c348 Don't migrate in Dockerfile 2020-11-14 23:50:02 +01:00
Yohann D'ANELLO
9867e5e2a8 Linting 2020-11-14 23:44:53 +01:00
Yohann D'ANELLO
48b34e4362 Ensure that teams have a participation 2020-11-14 23:43:42 +01:00
6 changed files with 11 additions and 9 deletions

View File

@ -16,9 +16,7 @@ RUN pip install -r requirements.txt --no-cache-dir
COPY . /code/ COPY . /code/
RUN python manage.py collectstatic --noinput && \ RUN python manage.py collectstatic --noinput && \
python manage.py compilemessages && \ python manage.py compilemessages
python manage.py migrate && \
python manage.py loaddata initial
# Configure nginx # Configure nginx
RUN mkdir /run/nginx RUN mkdir /run/nginx

View File

@ -1,7 +1,6 @@
from django.db.models import Q
from corres2math.lists import get_sympa_client from corres2math.lists import get_sympa_client
from django.core.management import BaseCommand from django.core.management import BaseCommand
from django.db.models import Q
from participation.models import Team from participation.models import Team
from registration.models import CoachRegistration, StudentRegistration from registration.models import CoachRegistration, StudentRegistration

View File

@ -65,7 +65,7 @@ class Team(models.Model):
"education", "education",
raise_error=False, raise_error=False,
) )
if self.participation.valid: if self.pk and self.participation.valid:
get_sympa_client().subscribe(self.email, "equipes", False, f"Equipe {self.name}") get_sympa_client().subscribe(self.email, "equipes", False, f"Equipe {self.name}")
get_sympa_client().subscribe(self.email, f"probleme-{self.participation.problem}", False, get_sympa_client().subscribe(self.email, f"probleme-{self.participation.problem}", False,
f"Equipe {self.name}") f"Equipe {self.name}")

View File

@ -2,7 +2,7 @@ from corres2math.lists import get_sympa_client
from participation.models import Participation, Team, Video from participation.models import Participation, Team, Video
def create_team_participation(instance, **_): def create_team_participation(instance, created, **_):
""" """
When a team got created, create an associated team and create Video objects. When a team got created, create an associated team and create Video objects.
""" """
@ -12,6 +12,8 @@ def create_team_participation(instance, **_):
if not participation.synthesis: if not participation.synthesis:
participation.synthesis = Video.objects.create() participation.synthesis = Video.objects.create()
participation.save() participation.save()
if not created:
participation.team.create_mailing_list()
def update_mailing_list(instance: Team, **_): def update_mailing_list(instance: Team, **_):

View File

@ -2,10 +2,13 @@
crond -l 0 crond -l 0
python manage.py migrate
python manage.py loaddata initial
nginx nginx
if [ "$CORRES2MATH_STAGE" = "prod" ]; then if [ "$CORRES2MATH_STAGE" = "prod" ]; then
gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread corres2math.wsgi --access-logfile '-' --error-logfile '-'; gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread corres2math.wsgi --access-logfile '-' --error-logfile '-';
else else
./manage.py runserver 0.0.0.0:8000; python manage.py runserver 0.0.0.0:8000;
fi fi