现在我有一个结构如下的 mod_wsgi 脚本..
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
我想知道是否有人知道一种方法可以将其更改为在yield
基础上操作而不是return
,这样我就可以在页面生成时发送页面,而不仅仅是在完成后发送,因此页面加载对用户来说可以更快。
但是,每当我将输出交换为列表并在 application() 中生成它时,它都会引发错误:
TypeError: sequence of string values expected, value of type list found