From 91218602e2946afe62820852406950cabae938a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Tue, 28 Jun 2022 13:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E4=BB=A3=E7=90=86mapConfig?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/utils/views.py | 8 ++++++++ server/urls.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/utils/views.py b/apps/utils/views.py index a2157471..188318dd 100755 --- a/apps/utils/views.py +++ b/apps/utils/views.py @@ -1,6 +1,7 @@ import os import cv2 +from django.http import HttpResponse from apps.utils.errors import SIGN_MAKE_FAIL from server.settings import BASE_DIR import numpy as np @@ -9,6 +10,7 @@ from rest_framework.exceptions import ParseError from apps.utils.viewsets import CustomGenericViewSet from apps.utils.mixins import CustomCreateModelMixin from apps.utils.serializers import GenSignatureSerializer +from rest_framework.views import APIView class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet): @@ -48,3 +50,9 @@ class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet): return Response({'path': new_path.replace(BASE_DIR, '')}) except Exception: 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') diff --git a/server/urls.py b/server/urls.py index 33ca90c9..fb998dc1 100755 --- a/server/urls.py +++ b/server/urls.py @@ -21,6 +21,7 @@ from drf_yasg import openapi from drf_yasg.views import get_schema_view from rest_framework.documentation import include_docs_urls from django.views.generic import TemplateView +from apps.utils.views import map_config schema_view = get_schema_view( openapi.Info( @@ -60,7 +61,7 @@ urlpatterns = [ 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/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")), ] + \