2

I'm new to GAE, WeasyPrint and Python. I realise that WeasyPrint relies on quite a few dependences. I have had a look at the install documentation for Windows. But I cant seem to figure out how I would get it working on GAE. Is there no way to download an version with all the dependencies included and just copy it to my project folder?

Karl Stulik
  • 961
  • 1
  • 12
  • 24
  • It is possible to achieve that using the custom runtime in GAE flexible environment. See [this](https://stackoverflow.com/questions/61600712/weasyprint-dockerfile-for-gae/61636670#61636670) example I wrote for more context. – Deniss T. May 07 '20 at 12:57

1 Answers1

3

Its not possible to run WeasyPrint directly on appengine. You should always read the docs on the dependencies. WeasyPrint is dependent on cairo and pango which are 'c' based libs. You can only run pure python libraries that you supply. There are some directly supported python libraries that do have some 'c' that are supported like PIL and libxml. But that isn't enough for WeasyPrint.

Tim Hoffman
  • 12,976
  • 1
  • 17
  • 29
  • Thank you for you feedback. But from the looks of it, I believe it is possible to use xhtml2pdf on GAE. I am having the same problem with dependencies though. Any suggestions on how to get it working? – Karl Stulik Apr 16 '14 at 11:05
  • I'm looking into whether or not this is still the case with the Python3.7 runtime, which allows specifying dependenceis with requirements.txt. As noted on on the Specifying Dependencies page (https://cloud.google.com/appengine/docs/standard/python3/specifying-dependencies) "You can use any Linux-compatible Python package, including packages that require native C extensions.". However it seems that Weasyprint does not include cairo and pango as part of it's installation, but relies on the system having them already installed. This appears to not work. – Mark Feb 05 '20 at 22:48
  • I think we can set custom runtime in flex env, and add the external dependencies in a dockerfile to be installed on GAE. i am having trouble with the dockerfile for weasyprint. For this to work you have to change the runtime from python to custom in app.yaml – Waqar May 04 '20 at 20:04