from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from api.views import MyAPIView
from rest_framework.schemas import get_schema_view
from rest_framework.documentation import include_docs_urls
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="API Documentation",
default_version='v1',),
public=False)
urlpatterns =[
path('admin/', admin.site.urls),
path(r'docs/', include_docs_urls(title='API文档')),
path('api/hello/', MyAPIView.as_view()),]
5.编写view.py视图
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.schemas import AutoSchema
classMyAPIView(APIView):"""
A simple API View with GET and POST methods.
"""
schema = AutoSchema()# 自动创建API文档的Schemadefget(self, request,*args,**kwargs):
response ={'message':'Hello, World!'}return Response(response)defpost(self, request,*args,**kwargs):
response ={'message':'Got some data!','data': request.data}return Response(response)
Abstract
JINA EMBEDINGS构成了一组高性能的句子嵌入模型,擅长将文本输入转换为数字表示,捕捉文本的语义。这些模型在密集检索和语义文本相似性等应用中表现出色。文章详细介绍了JINA EMBEDINGS的开发,从创建高质量的成对(pairwi…
什么是职责链(Chain of Responsibility)设计模式?
职责链(Chain of Responsibility)设计模式是一种行为型设计模式,旨在构建一个对象链,每个对象都有机会处理请求,并且可以将请求传…