Python 多线程windows apache服务器
我正在使用Apache2.2,我曾尝试运行两个线程(并行),但我发现这两个线程并没有按顺序运行 我怎样才能强制它同时(并行)运行?? test.wsgi::Python 多线程windows apache服务器,python,windows,multithreading,apache,flask,Python,Windows,Multithreading,Apache,Flask,我正在使用Apache2.2,我曾尝试运行两个线程(并行),但我发现这两个线程并没有按顺序运行 我怎样才能强制它同时(并行)运行?? test.wsgi:: import time def application(environ, start_response): status = '200 OK' output = str(time.time()) time.sleep(5) output += '<br/>' + str(time.time(
import time
def application(environ, start_response):
status = '200 OK'
output = str(time.time())
time.sleep(5)
output += '<br/>' + str(time.time())
response_headers = [('Content-type', 'text/html; charset=utf-8'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
导入时间
def应用程序(环境、启动和响应):
状态='200正常'
output=str(time.time())
时间。睡眠(5)
输出+='
'+str(time.time())
响应_headers=[('Content-type','text/html;charset=utf-8'),
('Content-Length',str(len(output)))]
启动\u响应(状态、响应\u标题)
返回[输出]
我在httpd.conf的末尾插入了以下内容:
Include conf/extra/httpd-mpm.conf
<IfModule mpm_winnt_module>
ThreadsPerChild 253
MaxRequestsPerChild 0
</IfModule>
<VirtualHost *>
ServerName localhost
WSGIScriptAlias / C:\test\test.wsgi
<Directory C:\test>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
包括conf/extra/httpd-mpm.conf
螺纹预裂253
MaxRequestsPerChild 0
服务器名本地主机
WSGIScriptAlias/C:\test\test.wsgi
命令拒绝,允许
通融
我知道这是可行的但不是平行的 第一个线程: 1374420108.56 1374420113.56 第二个线程: 1374420113.57 1374420118.57
感谢问题解决了,这似乎是“测试误用”,我用同一个浏览器的多个选项卡进行了测试,但不知何故,浏览器无法处理这些多个并发请求,所以我用不同的浏览器进行了测试,结果正常