[Solved]-Django WeasyPrint CSS integration warning: Relative URI reference without a base URI: <link href="/static/css/bootstrap.min.css"> at line None

22👍

I had to add base_url=request.build_absolute_uri(). So the print command looks like:

weasyprint.HTML(string=html,base_url=request.build_absolute_uri()).write_pdf(response)

0👍

Adding ‘/’ to request.build_absolute_uri() worked for me -> request.build_absolute_uri(‘/’):

weasyprint.HTML(string=html,base_url=request.build_absolute_uri('/')).write_pdf(response)

Leave a comment