简体   繁体   English

Python rest api 放置方法抛出 500

[英]Python rest api Put method throws 500

I have following python code我有以下 python 代码

https://github.com/salikhanan/my_login_testing/blob/master/login_app/api.py https://github.com/salikhanan/my_login_testing/blob/master/login_app/api.py

Here when a put request is made to update user data It throws在这里,当发出更新用户数据的 put 请求时,它会抛出

<title>500 Internal Server Error</title>

while it works fine when a get request is made to retrieve data for a single user.当发出获取请求以检索单个用户的数据时,它可以正常工作。 Can someone see what is wrong with PUT?有人可以看到 PUT 有什么问题吗? I would really appreciate it.我真的很感激。 I saw this project online to learn automation but I got myself stuck with this error.我在网上看到了这个项目来学习自动化,但我被这个错误困住了。

The 500 is probably due to an exception being raised and not caught in your application code. 500 可能是由于引发了异常并且未在您的应用程序代码中捕获。 You should run your app in development mode:您应该在开发模式下运行您的应用程序:

export FLASK_ENV=development

.. then start the server with flask run . .. 然后用flask run启动服务器。 Now when you get the error, you will see in the browser a traceback pointing out the exact statement which is raising an exception.现在,当您收到错误消息时,您将在浏览器中看到一条回溯,指出引发异常的确切语句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM