阅读背景:

dlopen()未能加载一个库:cairo / cairo-2

来源:互联网 

This is my view:

这是我的观点:

from django.conf import settings
from django.http import HttpResponse
from django.template.loader import render_to_string
import weasyprint



    @staff_member_required
    def admin_order_pdf(request, order_id):
        order = get_object_or_404(Order, id=order_id)
        html = render_to_string('orders/order/pdf.html', {'order': order})
        response = HttpResponse(content_type='application/pdf')
        response['Content-Disposition'] = 'filename="order_{}.pdf"'.format(order.id)
        weasyprint.HTML(string=html).write_pdf(response,
                                               stylesheets=[weasyprint.CSS(settings.STATIC_ROOT + 'css/pdf.css')])
        return response
from django.conf i



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: