后端代理mapConfig文件
This commit is contained in:
parent
396a26ab15
commit
91218602e2
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import cv2
|
import cv2
|
||||||
|
from django.http import HttpResponse
|
||||||
from apps.utils.errors import SIGN_MAKE_FAIL
|
from apps.utils.errors import SIGN_MAKE_FAIL
|
||||||
from server.settings import BASE_DIR
|
from server.settings import BASE_DIR
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -9,6 +10,7 @@ from rest_framework.exceptions import ParseError
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
from apps.utils.mixins import CustomCreateModelMixin
|
from apps.utils.mixins import CustomCreateModelMixin
|
||||||
from apps.utils.serializers import GenSignatureSerializer
|
from apps.utils.serializers import GenSignatureSerializer
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
|
||||||
class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
||||||
|
@ -48,3 +50,9 @@ class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
||||||
return Response({'path': new_path.replace(BASE_DIR, '')})
|
return Response({'path': new_path.replace(BASE_DIR, '')})
|
||||||
except Exception:
|
except Exception:
|
||||||
raise ParseError(**SIGN_MAKE_FAIL)
|
raise ParseError(**SIGN_MAKE_FAIL)
|
||||||
|
|
||||||
|
|
||||||
|
def map_config(request):
|
||||||
|
path = os.path.join(BASE_DIR, 'dist/data/map/0000/mapConfig.conf')
|
||||||
|
with open(path) as f:
|
||||||
|
return HttpResponse(f.read(), content_type='application/octet-stream')
|
||||||
|
|
|
@ -21,6 +21,7 @@ from drf_yasg import openapi
|
||||||
from drf_yasg.views import get_schema_view
|
from drf_yasg.views import get_schema_view
|
||||||
from rest_framework.documentation import include_docs_urls
|
from rest_framework.documentation import include_docs_urls
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
from apps.utils.views import map_config
|
||||||
|
|
||||||
schema_view = get_schema_view(
|
schema_view = get_schema_view(
|
||||||
openapi.Info(
|
openapi.Info(
|
||||||
|
@ -60,7 +61,7 @@ urlpatterns = [
|
||||||
path('api/docs/', include_docs_urls(title="接口文档", authentication_classes=[], permission_classes=[])),
|
path('api/docs/', include_docs_urls(title="接口文档", authentication_classes=[], permission_classes=[])),
|
||||||
path('api/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
path('api/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
||||||
path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
|
path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
|
||||||
|
path('data/map/0000/mapConfig.conf', map_config),
|
||||||
# 前端页面入口
|
# 前端页面入口
|
||||||
path('', TemplateView.as_view(template_name="index.html")),
|
path('', TemplateView.as_view(template_name="index.html")),
|
||||||
] + \
|
] + \
|
||||||
|
|
Loading…
Reference in New Issue