WSGI应用
# coding: utf-8
import time
def application(environ, start_response):
status = '200 OK'
output = str(time.time())
time.sleep(5)
output += ' -> ' + str(time.time())
response_headers = [('Content-type', 'text/html; charset=utf-8'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Apache 虚拟主机
ServerName localhost
WSGIDaemonProcess main user=www-data group=www-data processes=1 threads=5
WSGIScriptAlias / /var/www/main/main.wsgi
WSGIProcessGroup main
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
ErrorLog /var/log/apache2/main_error_log
CustomLog /var/log/apache2/main_log common
连接多个客户端,它们按顺序处理,没有多线程。为什么?
最佳答案
mod_wsgi 邮件列表正在处理此问题。请参阅:
http://groups.google.com/group/modwsgi/browse_frm/thread/b8aaab6bfc4cca6d
关于python - mod_wsgi + apache不是多线程的,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3341514/