且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从另一种观点认为我的服务器上调用API

更新时间:2022-12-17 13:54:48

现在您的评论澄清的情况下,我可以在什么问题采取了猜测。这是您正在使用内置的开发服务器,这是单线程的。因此,尽管它的处理原始的请求,这是无法处理的另一个URL的内在要求 - 所以无限期挂起

Now your comment has clarified the situation, I can take a guess at what the problem is. It is that you are using the built-in development server, which is single-threaded. So while it's processing the original request, it's not able to process the internal request for another URL - so it hangs indefinitely.

解决方案,正如***所指出的,是想一个更好的架构。如果你不能做到这一点,你可能有一些运气使用像 gunicorn ,而不是内置的服务器。

The solution, as Mao points out, is to think of a better architecture. If you can't do that, you may have some luck with using something like gunicorn instead of the built-in server.