Files
tabby-web/tabby/app/views.py

27 lines
919 B
Python
Raw Normal View History

2021-06-15 23:43:23 +02:00
import os
2021-06-12 13:05:35 +02:00
from django.conf import settings
from django.views import static
2021-06-15 23:43:23 +02:00
from rest_framework.views import APIView
2021-06-12 13:05:35 +02:00
class IndexView(APIView):
def get(self, request, format=None):
2021-06-14 23:00:05 +02:00
return static.serve(request, 'index.html', document_root=str(settings.BASE_DIR / 'build'))
class TerminalView(APIView):
def get(self, request, format=None):
response = static.serve(request, 'terminal.html', document_root=str(settings.BASE_DIR / 'build'))
response['X-Frame-Options'] = 'SAMEORIGIN'
return response
2021-06-12 13:05:35 +02:00
class AppDistView(APIView):
2021-06-15 23:43:23 +02:00
def get(self, request, version=None, path=None, format=None):
return static.serve(request, os.path.join(version, path), document_root=str(settings.APP_DIST_PATH))
2021-06-12 13:05:35 +02:00
2021-07-11 16:13:18 +02:00
# class BuildView(APIView):
# def get(self, request, path=None, format=None):
# return static.serve(request, path, document_root=str(settings.BASE_DIR / 'build'))