我使用的是DRF建议使用的状态代码,即"HTTP_405_METHOD_NOT_ALLOWED“--然而,在我看来,虽然这是可行...
看起来您需要做的就是将POST方法转移到CreateEstablishmentView类下面,这样POST方法就是该类的方法。
self.http_method_names.append("GET") serializer = UserSerializerWithToken(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) 编辑:urls.py from djang...
如下:报错405:HTTP method GET is not supported by this URL宝塔面板phpmyadmin访问出现405 Not Allow...
3、song_info:根据用户的GET请求参数进行数据查询。若请求参数为空,则对全部歌曲进行筛选,获取播放次数排在前10位的歌曲;若请求参数不为空,则根据参数内容进行歌曲筛选,获取播放次数排在前10为的歌曲。 根据视图函数rankingView所生成的变量,我们在模板ranking.html中编写相关的模板语法,由于模板ranking.html的代码较多...
@router.get('/{str:name}') def get_(request, name: str) ... @router.put('/{int:pk}') def put_(request, pk: int) ... put request will be sent: Error: Method Not Allowed I try to use post or patch, it still is: Error: Method Not Allowed If @router.get('/{str:name...
If True (the default), the object’s get_absolute_url() method will be used to generate the url. If your model has a get_absolute_url() method but you don’t want the “View on site” button to appear, you only need to set view_on_site to False: from django.contrib import ...
Django REST Framework login and logout views Posted on 2024年3月14日 at 18:26 byStack OverflowRSS I'm building a system using django, django rest framework, django oauth toolkit, django axes in a microservices architecture but I have some doubts. Currently I have my "login" view...
"detail": "Method \"GET\" not allowed." } 我在这里错过了什么。 错误是因为它在您的 API 类中搜索get()方法,但找不到。 API类的一般格式如下 class LocationView(views.APIView): def get(self, request): #do something with 'GET' method ...
Raises django.core.exceptions.DisallowedHost if the host is not in ALLOWED_HOSTS or the domain name is invalid according to RFC 1034/1035. Note The get_host() method fails when the host is behind multiple proxies. One solution is to use middleware to rewrite the proxy headers, as in the ...