Commit 9bb31ea6 by Chif Gergő

Fix wrong filestructure

parent 6f14cf2e
Pipeline #1076 passed with stage
in 1 minute 41 seconds
......@@ -52,6 +52,7 @@ LOCAL_APPS = [
"storage",
"template",
"authorization",
"status",
]
INSTALLED_APPS += LOCAL_APPS
......
from django.apps import AppConfig
class StatusConfig(AppConfig):
name = 'status'
# import json
from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from recircle.instance.models import Instance
import logging
logger = logging.getLogger(__name__)
class StatusConsumer(WebsocketConsumer):
def connect(self):
instances = Instance.objects.all()
for inst in instances:
async_to_sync(self.channel_layer.group_add)(
str(inst.id),
self.channel_name
)
def disconnect(self):
instances = Instance.objects.all()
for inst in instances:
async_to_sync(self.channel_layer.group_discard)(
str(inst.id),
self.channel_name
)
def receive(self, text_message):
pass
def status_changed(self, event):
logger.info("Event received")
self.send(text_data=event["status"])
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'ws/instance/(?P<vm_id>\w+)/$', consumers.StatusConsumer),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment