create folders for components;
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import logging
|
||||
|
||||
from django.http import JsonResponse
|
||||
|
||||
from rest_framework.decorators import api_view
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestApiClass:
|
||||
@staticmethod
|
||||
@api_view(['GET'])
|
||||
def test_api(request):
|
||||
logger.debug('Test api call: {}'.format(request))
|
||||
return JsonResponse({'Result': 'success'}, safe=False)
|
||||
@@ -0,0 +1,18 @@
|
||||
import logging
|
||||
|
||||
from channels.generic.websocket import WebsocketConsumer
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CustomConsumer(WebsocketConsumer):
|
||||
def connect(self):
|
||||
self.accept()
|
||||
|
||||
def receive(self, text_data=None, bytes_data=None):
|
||||
self.send('1. response: {}'.format(text_data))
|
||||
self.send('2. response: {}'.format(text_data))
|
||||
|
||||
def disconnect(self, code):
|
||||
pass
|
||||
Reference in New Issue
Block a user