Source code for oioioi.notifications.management.commands.notifications_server

import os

from django.conf import settings
from django.core.management.base import BaseCommand


[docs]class Command(BaseCommand):
[docs] help = "Runs the OIOIOI notifications server"
[docs] requires_model_validation = False
[docs] def add_arguments(self, parser): parser.add_argument( '-i', '--install', action='store_true', help="install dependencies required by the server", )
[docs] def handle(self, *args, **options): path = os.path.join(os.path.dirname(__file__), '..', '..', 'server') os.chdir(path) if options['install']: os.execlp('env', 'env', 'npm', 'install') else: os.execlp( 'env', 'env', 'node', 'ns-main.js', '--port', settings.NOTIFICATIONS_SERVER_PORT.__str__(), '--url', settings.NOTIFICATIONS_OIOIOI_URL, '--amqp', settings.NOTIFICATIONS_RABBITMQ_URL, )