Django-rest post returns 得到
Django-rest post returns get
我用 django-rest 构建了一个 API,在本地机器上对其进行了测试,并将其推送到我的 PaaS。在我的本地机器上,与 post 关联的视图运行良好。实时站点抛出错误。
相关视图的装饰器:@api_view(['POST'])
Error: u'{"detail":"Method \"GET\" not allowed."}'.
Python请求模块片段(注POST未获取):
r = requests.post(my_url, data=json.dumps(payload), headers=headers, verify=False)
服务器日志:"POST /api/xxx/xxx/ HTTP/1.1" 301
服务器日志中没有错误,django-rest 中没有错误API。该函数的 post 确实适用于可浏览的 API。为什么我在 post 上收到 GET 错误?我在 curl 中尝试过一些事情并收到相同的错误。怎么回事?
知道了。 URL 中未反映从 http 到 https 的移动。
我用 django-rest 构建了一个 API,在本地机器上对其进行了测试,并将其推送到我的 PaaS。在我的本地机器上,与 post 关联的视图运行良好。实时站点抛出错误。
相关视图的装饰器:@api_view(['POST'])
Error: u'{"detail":"Method \"GET\" not allowed."}'.
Python请求模块片段(注POST未获取):
r = requests.post(my_url, data=json.dumps(payload), headers=headers, verify=False)
服务器日志:"POST /api/xxx/xxx/ HTTP/1.1" 301
服务器日志中没有错误,django-rest 中没有错误API。该函数的 post 确实适用于可浏览的 API。为什么我在 post 上收到 GET 错误?我在 curl 中尝试过一些事情并收到相同的错误。怎么回事?
知道了。 URL 中未反映从 http 到 https 的移动。