我正在尝试将TokenAuthentication与我的一个视图一起使用.如https://www.django-rest-framework.org/api-guide/authentication/中所述,我将登录时收到的令牌添加为我发送的请求中称为"授权"的HTTP头.
问题是在我的单元测试中,身份验证失败了.查看TokenAuthentication类,我看到正在检查的标头是'HTTP_AUTHORIZATION'而不是'授权'
我正在使用的视图:
class DeviceCreate(generics.CreateAPIView):
model = Device
serializer_class = DeviceSerializer
authentication_classes = (TokenAuthentication,)
permission_classes = (IsAuthenticated,)
Run Code Online (Sandbox Code Playgroud)
将标题更改为"HTTP_AUTHORIZATION"似乎有效,但感觉不对.
我错过了什么吗?
django authorization django-rest-framework http-token-authentication
我正在尝试实现一个Mesos框架,其中有一个带有自定义调度逻辑和长时间运行任务的调度程序.
有时,由于代码部署,需要重新启动调度程序.
我注意到,每当调度程序断开连接时,所有正在运行的执行程序都会停止.
I0202 14:12:48.099814 8539 exec.cpp:383] Executor asked to shutdown
Run Code Online (Sandbox Code Playgroud)
我的目标:
我希望执行程序在调度程序重启期间继续运行.
我希望调度程序在重新启动时检测活动任务.
我可以用mesos实现这个目标吗?