【发布时间】:2013-04-27 12:21:55
【问题描述】:
我已经实现了打印pdf功能。我使用 pyramid、wkhtmltopdf 和 jinja2 来生成 pdf。它在 gunicorn 中运行良好。但是,当我将其部署到生产环境时(我使用 circusd 在生产环境中运行),该功能会失败且没有任何错误消息。源码如下:
pdf_renderer = PDFRenderer()
request = self.request
html = render('test.jinja2' , pdf_data, request)
response = request.response
response.write(pdf_renderer(html))
response.content_type = 'application/pdf'
response.headerlist.append(('Content-Disposition', 'attachment; filename='test.pdf'))
#Everything is ok except the final statement.
#circusd cannot run the statement "return response"
#However, gunicorn can do it
return response
那么,您对我的问题有什么建议或想法吗?它是如此直截了当,我不明白为什么它在 gunicorn 中可以正常工作,但在 circusd 中却失败了
【问题讨论】:
-
circusd你的意思是 chaussette,如果是,什么后端? Circus 不是 WSGI 服务器,应该不会影响可以发送的响应类型。
标签: pyramid wkhtmltopdf circusd