Compare commits
10 Commits
2eb2884b46
...
20e0d1333b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
20e0d1333b | ||
d64df414eb | |||
0e632f3922 | |||
0dadaaf425 | |||
53f14be059 | |||
dd2ada6f26 | |||
600a308c70 | |||
a05edc8945 | |||
![]() |
acde744461 | ||
![]() |
dfec871198 |
@ -1,10 +1,11 @@
|
|||||||
FROM docker:dind
|
FROM docker:dind
|
||||||
|
|
||||||
RUN apk add --update python3 && ln -sf python3 /usr/bin/python
|
RUN apk add --update python3 && ln -sf python3 /usr/bin/python
|
||||||
RUN python3 -m ensurepip
|
|
||||||
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev jpeg-dev zlib-dev libjpeg
|
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev jpeg-dev zlib-dev libjpeg
|
||||||
RUN pip3 install --upgrade pip wheel setuptools
|
RUN apk add py3-pip
|
||||||
RUN addgroup -S docker
|
RUN python3 -m venv venv
|
||||||
|
RUN source venv/bin/activate
|
||||||
|
RUN pip install --break-system-packages --upgrade pip wheel setuptools
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
ENV DJANGO_SETTINGS_MODULE Sprint.settings
|
ENV DJANGO_SETTINGS_MODULE Sprint.settings
|
||||||
@ -14,7 +15,7 @@ COPY requirements.txt /usr/src/app/requirements.txt
|
|||||||
|
|
||||||
WORKDIR /usr/src/app/
|
WORKDIR /usr/src/app/
|
||||||
|
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip install -r requirements.txt --break-system-packages
|
||||||
|
|
||||||
COPY . /usr/src/app/
|
COPY . /usr/src/app/
|
||||||
|
|
||||||
|
16
Main/migrations/0040_delete_subscription.py
Normal file
16
Main/migrations/0040_delete_subscription.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Generated by Django 3.2.4 on 2022-10-20 17:42
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Main', '0039_auto_20221013_1855'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Subscription',
|
||||||
|
),
|
||||||
|
]
|
@ -2,7 +2,6 @@ from Main.models.userinfo import UserInfo
|
|||||||
from Main.models.group import Group
|
from Main.models.group import Group
|
||||||
from Main.models.task import Task
|
from Main.models.task import Task
|
||||||
from Main.models.set import Set
|
from Main.models.set import Set
|
||||||
from Main.models.subscription import Subscription
|
|
||||||
from Main.models.settask import SetTask
|
from Main.models.settask import SetTask
|
||||||
from Main.models.solution import Solution
|
from Main.models.solution import Solution
|
||||||
from Main.models.extrafile import ExtraFile
|
from Main.models.extrafile import ExtraFile
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
from django.db import models
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
from Main.models.group import Group
|
|
||||||
|
|
||||||
|
|
||||||
class Subscription(models.Model):
|
|
||||||
group = models.ForeignKey(
|
|
||||||
Group, on_delete=models.CASCADE, related_name="subscriptions"
|
|
||||||
)
|
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
||||||
role = models.IntegerField()
|
|
@ -36,11 +36,11 @@ class MainView(BaseView):
|
|||||||
all_tasks = Task.objects.filter(solution__user=self.request.user).distinct()
|
all_tasks = Task.objects.filter(solution__user=self.request.user).distinct()
|
||||||
ok_tasks = all_tasks.filter(solution__result="OK").distinct()
|
ok_tasks = all_tasks.filter(solution__result="OK").distinct()
|
||||||
undone_tasks = set(all_tasks) - set(ok_tasks)
|
undone_tasks = set(all_tasks) - set(ok_tasks)
|
||||||
self.context['undone_tasks'] = sample(undone_tasks, k=min(5, len(undone_tasks)))
|
self.context['undone_tasks'] = sample(list(undone_tasks), k=min(5, len(undone_tasks)))
|
||||||
for task in self.context['undone_tasks']:
|
for task in self.context['undone_tasks']:
|
||||||
setattr(task, 'solution', Solution.objects.filter(user=self.request.user, task=task).last())
|
setattr(task, 'solution', Solution.objects.filter(user=self.request.user, task=task).last())
|
||||||
new_tasks = set(Task.objects.filter(public=True)) - set(all_tasks)
|
new_tasks = set(Task.objects.filter(public=True)) - set(all_tasks)
|
||||||
self.context['new_tasks'] = sample(new_tasks, k=min(5, len(new_tasks)))
|
self.context['new_tasks'] = sample(list(new_tasks), k=min(5, len(new_tasks)))
|
||||||
self.context['groups'] = Group.objects.filter(
|
self.context['groups'] = Group.objects.filter(
|
||||||
Q(editors__in=self.request.user.username) | Q(creator=self.request.user) | Q(
|
Q(editors__in=self.request.user.username) | Q(creator=self.request.user) | Q(
|
||||||
users=self.request.user)).distinct()
|
users=self.request.user)).distinct()
|
||||||
|
@ -6,6 +6,7 @@ from django.db import transaction
|
|||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django import db
|
||||||
from pika.adapters.utils.connection_workflow import AMQPConnectorException
|
from pika.adapters.utils.connection_workflow import AMQPConnectorException
|
||||||
|
|
||||||
from Main.models.outbox_message import OutboxMessage
|
from Main.models.outbox_message import OutboxMessage
|
||||||
@ -37,6 +38,7 @@ class MessagingSupport(BaseCommand):
|
|||||||
print("Message is not JSON decodable")
|
print("Message is not JSON decodable")
|
||||||
return
|
return
|
||||||
print(f"Got {data}, processing...")
|
print(f"Got {data}, processing...")
|
||||||
|
db.close_old_connections()
|
||||||
try:
|
try:
|
||||||
outbox_message = OutboxMessage.objects.get(id=data["id"])
|
outbox_message = OutboxMessage.objects.get(id=data["id"])
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
|
@ -2,7 +2,7 @@ events {}
|
|||||||
|
|
||||||
http {
|
http {
|
||||||
server {
|
server {
|
||||||
listen 1235;
|
listen 1238;
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://web:8000/;
|
proxy_pass http://web:8000/;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
aiofiles==0.7.0
|
aiofiles==0.7.0
|
||||||
aiohttp==3.8.0
|
aiohttp==3.9.0b0
|
||||||
amqp==5.0.6
|
amqp==5.0.6
|
||||||
asgiref==3.3.4
|
asgiref==3.3.4
|
||||||
billiard==3.6.4.0
|
billiard==3.6.4.0
|
||||||
|
Loading…
Reference in New Issue
Block a user