python - how to make django HttpResponse return faster than 1 second
问题描述
I am running Django on localhost using the Django development server. I have a view that just returns HttpResponse("hello world").
def simpleview(request):
return HttpResponse("hello world")
I make a GET request with jquery to that view.
Looking in the browser, it shows that this takes 1.3 seconds to return which is very slow.
Is there any way to check what is going on? I am trying to use this for autocomplete, and a waiting time of 1.3 seconds for a virtually empty response is unusable.
解决方案
When running on apache the latency issue went away, so it seems to be a problem with the python development server. In addition, i setup connection pooling to stop the reconnect on every request. This had no effect on the dev server though. The pooling was done by sqlalchemy pool for PostgreSQL.
推荐阅读
- android - Flutter - 无法在android设备中运行
- python - 如何使 1 个变量减去另一个变量始终为正?
- python - 我不能在类中使用特定的列表函数,但没有类它可以正常工作
- python-3.x - 为什么在异常后引发?
- c# - C# 中的 Web Scraping 无法按预期工作
- arrays - 这个函数的返回值是什么
- python - 无法使用 selenium 从页面中名为“heading”的每个类中获取数据
- asp.net-mvc - 首先生成下拉asp.net mvc代码
- javascript - JS 字符串字面量
- javascript - 为什么空数组通过 if(array !== []) 检查