diff --git a/Main/views/AccountView.py b/Main/views/AccountView.py index 90eff50..857fd23 100644 --- a/Main/views/AccountView.py +++ b/Main/views/AccountView.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import User from django.db.models import Q -from Main.management.commands.bot import bot +from daemons import bot from Main.models import Friendship from SprintLib.BaseView import BaseView from SprintLib.language import languages diff --git a/Main/views/SendCodeView.py b/Main/views/SendCodeView.py index 4d7efda..4bd8f78 100644 --- a/Main/views/SendCodeView.py +++ b/Main/views/SendCodeView.py @@ -1,6 +1,6 @@ from django.contrib.auth import login -from Main.management.commands.bot import bot +from daemons import bot from SprintLib.BaseView import BaseView from django.contrib.auth.models import User from random import randrange diff --git a/Sprint/settings.py b/Sprint/settings.py index a2276ca..a14d667 100644 --- a/Sprint/settings.py +++ b/Sprint/settings.py @@ -44,6 +44,7 @@ INSTALLED_APPS = [ "Main.apps.MainConfig", "Checker.apps.CheckerConfig", "Messaging.apps.MessagingConfig", + "daemons.apps.DaemonsConfig", ] MIDDLEWARE = [ diff --git a/SprintLib/testers/BaseTester.py b/SprintLib/testers/BaseTester.py index 7332c37..2ac9309 100644 --- a/SprintLib/testers/BaseTester.py +++ b/SprintLib/testers/BaseTester.py @@ -2,7 +2,7 @@ from os import listdir, mkdir from os.path import join, exists from subprocess import call, TimeoutExpired -from Main.management.commands.bot import bot +from daemons import bot from Main.models import ExtraFile, SolutionFile from Main.models.progress import Progress from Sprint.settings import CONSTS diff --git a/daemons/__init__.py b/daemons/__init__.py new file mode 100644 index 0000000..b540b4c --- /dev/null +++ b/daemons/__init__.py @@ -0,0 +1 @@ +from .management.commands.bot import bot diff --git a/daemons/apps.py b/daemons/apps.py new file mode 100644 index 0000000..d892ac1 --- /dev/null +++ b/daemons/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DaemonsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'daemons' diff --git a/Main/management/__init__.py b/daemons/management/__init__.py similarity index 100% rename from Main/management/__init__.py rename to daemons/management/__init__.py diff --git a/Main/management/commands/__init__.py b/daemons/management/commands/__init__.py similarity index 100% rename from Main/management/commands/__init__.py rename to daemons/management/commands/__init__.py diff --git a/Main/management/commands/apply_languages.py b/daemons/management/commands/apply_languages.py similarity index 100% rename from Main/management/commands/apply_languages.py rename to daemons/management/commands/apply_languages.py diff --git a/Main/management/commands/bot.py b/daemons/management/commands/bot.py similarity index 100% rename from Main/management/commands/bot.py rename to daemons/management/commands/bot.py diff --git a/Main/management/commands/loop.py b/daemons/management/commands/loop.py similarity index 100% rename from Main/management/commands/loop.py rename to daemons/management/commands/loop.py diff --git a/Main/management/commands/receive.py b/daemons/management/commands/receive.py similarity index 92% rename from Main/management/commands/receive.py rename to daemons/management/commands/receive.py index b31d506..d1c17ec 100644 --- a/Main/management/commands/receive.py +++ b/daemons/management/commands/receive.py @@ -3,7 +3,7 @@ from shutil import rmtree import pika from django.core.management.base import BaseCommand -from pika.adapters.utils.connection_workflow import AMQPConnectionWorkflowFailed +from pika.adapters.utils.connection_workflow import AMQPConnectorException from Main.models import Solution from Sprint import settings @@ -40,5 +40,5 @@ class Command(BaseCommand): channel.basic_consume(queue="test", on_message_callback=callback, auto_ack=True) channel.start_consuming() - except AMQPConnectionWorkflowFailed: + except AMQPConnectorException: print("connection to rabbit failed: reconnecting") diff --git a/Main/management/commands/storage.py b/daemons/management/commands/storage.py similarity index 100% rename from Main/management/commands/storage.py rename to daemons/management/commands/storage.py diff --git a/Main/management/commands/success_deploy.py b/daemons/management/commands/success_deploy.py similarity index 87% rename from Main/management/commands/success_deploy.py rename to daemons/management/commands/success_deploy.py index 4c65a0c..9116793 100644 --- a/Main/management/commands/success_deploy.py +++ b/daemons/management/commands/success_deploy.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import User from django.core.management import BaseCommand -from Main.management.commands.bot import bot +from daemons.management import bot class Command(BaseCommand): diff --git a/daemons/migrations/__init__.py b/daemons/migrations/__init__.py new file mode 100644 index 0000000..e69de29