Monday, 15 October 2018

Python 3 flask install wkhtmltopdf on heroku

I have a problem to install the wkhtmltopdf binary on my heroku python app (flask).

A year ago (python 2) I already had an issue, but I was able to solve it by first adding the wkhtmltopdf-pack to the requirements and installing it on heroku and then setting the config var to WKHTMLTOPDF_BINARY=wkhtmltopdf-pack. Here is my old thread

Problem now:

I am trying to use the same approach for python 3, but no version of the wkhtmltopdf-pack works, every push gets rejected and I cant install it.

I tried these versions in the requirements:

wkhtmltopdf-pack==0.12.5

wkhtmltopdf-pack==0.12.4

wkhtmltopdf-pack==0.12.3

wkhtmltopdf-pack==0.12.3.0.post1

wkhtmltopdf-pack==0.12.2.4

I get these errors:

No matching distribution

or

error: can't copy 'bin/wkhtmltopdf-pack': doesn't exist or not a regular file

and I remember once it told me there was a SyntaxError and it could not decode something.

Alternative approach:

It seems it is also possible to use a buildpack, so I tried adding a buildpack:

heroku buildpacks:add https://github.com/dscout/wkhtmltopdf-buildpack.git

I see that the buildpack has been added, but there was no installation and there is also no config var for wkhtmltopdf. I dont understand how to trigger the installation, in all documantations for buildpacks its written "add the buildpack and you are ready to go".

Trying to create a PDF gives me a server error here:

OSError: No wkhtmltopdf executable found: "b''"



from Python 3 flask install wkhtmltopdf on heroku

No comments:

Post a Comment