Python weasyprint不加载烧瓶图像
您好,朋友们,我有一个从flask使用weasyprint生成pdf的代码,它可以工作并生成pdf,但我正在渲染的html有两个图像,它不能为我渲染它们。我有以下代码:Python weasyprint不加载烧瓶图像,python,python-3.x,pdf,flask,Python,Python 3.x,Pdf,Flask,您好,朋友们,我有一个从flask使用weasyprint生成pdf的代码,它可以工作并生成pdf,但我正在渲染的html有两个图像,它不能为我渲染它们。我有以下代码: from weasyprint import HTML image = "/static/images/logo-ori.png" name = "Pepito perez" print_html = render_template('cert/certificado.html', img
from weasyprint import HTML
image = "/static/images/logo-ori.png"
name = "Pepito perez"
print_html = render_template('cert/certificado.html', img=image)
到目前为止,图像呈现sim问题,但当我将其转换为pdf时,它不再呈现
cert = os.path.join(url_direct, "certificado.pdf")
pdf = HTML(string=print_html)
pdf.write_pdf(cert)
pdf存储在服务器上,这正是我想要做的,使用flask我重定向到开始,我希望他们能帮助我我正在复习如何使用flask weasyprint,但我无法将pdf存储在服务器上,我希望他们能帮助我使用这两种方法中的任何一种。提前感谢您感谢您的朋友,他们可以使用Pythony提供的相同解决方案帮助您解决错误,以下链接是所有信息: