我已经编写了如下代码片段,我需要在此实现分页,请让我知道它是如何可能的.另外由于某些原因,我想只使用基于功能的视图.
@api_view(['GET',])
@permission_classes([AllowAny,])
def PersonView(request):
context={'request': request}
person_objects = Person.objects.all()
if len(person_objects)> 0:
person_data = PersonSerializer(person_objects,many=True,context=context)
return Response(person_data.data,status=status.HTTP_200_OK)
else:
return Response({},status=status.HTTP_200_OK)
Run Code Online (Sandbox Code Playgroud) 我第一次使用 azure 服务总线在 C# 源和 python 客户端之间传输消息。
我正在创建 ServiceBusService 对象并使用它从函数receive_subscription_message 中获取消息。
我得到的有效载荷不符合预期。
我的代码如下所示。
bus_service = ServiceBusService(service_namespace="service_namespace", shared_access_key_name="All", shared_access_key_value="password")
msg = bus_service.receive_subscription_message('test', 'test', peek_lock=True)
print(msg.body)
msg.delete()
Run Code Online (Sandbox Code Playgroud)
msg.body 给出一个字节字符串,如下所示:
b'@\x06string\x083http://schemas.microsoft.com/2003/10/Serialization/\x9ae\x0c{"PUID":"3NFLzV3cjCp8f5JLh3KSnkXDgSw1FWgM","HardDelete":null}\x01'
本来是把json推进去的。有没有办法避免额外的参数并只获取原始json?
我想在golang中获取一个外部库但是当我在命令下面触发时:
FROM golang:1.8-alpine
RUN go get gopkg.in/natefinch/lumberjack.v2
EXPOSE 8080
Run Code Online (Sandbox Code Playgroud)
它给出了以下错误:
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/gin-gonic/gin: exec: "git": executable file not found in $PATH
Run Code Online (Sandbox Code Playgroud)
我正在使用golang:1.8-alpine.请帮忙解决这个问题.