我正在将 HTML 文件转换为 python 中的 pdf 并将这些 pdf 文件附加到邮件并处理它
我已经为 Windows 安装了 pdfkit(0.6.1)、wkhtmltopdf(0.2) 和 wkhtmltopdf。并添加了 wkhtmltopdf bin 路径。它在我的本地系统中运行没有任何问题这是我的代码
url="" PDF = pdfkit.from_url(url, False) result= SendPDFtomail(PDF) return result
当我尝试通过添加 wkhtmltopdf 的 buildpack 并将我的应用程序的 buildpacks 推送到 heroku 中时
1. heroku/python 2. https://github.com/dscout/wkhtmltopdf-buildpack.git
当我将构建推送到heroku时
git push heroku master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 336 bytes | 84.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: ! The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.4, which is unsupported). remote: ! We recommend upgrading by specifying the latest version (python-3.6.6). remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes remote: -----> Installing requirements with pip remote: remote: -----> wkhtmltopdf app detected remote: -----> Moving wkhtmltopdf binaries to /app/bin remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... remote: Done: 103.8M remote: -----> Launching... remote: Released v19 remote: https://XXXXXXX.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy... done.
我的应用程序部署没有任何问题,当我在 Heroku 中运行代码时出现错误
Exception :No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it.
Otherwise please install wkhtmltopdf -
https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
这与我没有将 wkhtmltopdf 路径添加到系统时收到的错误相同,正如我们在构建中看到的那样Moving wkhtmltopdf binaries to /app/bin
,如何使 Heroku 配置到这个 wkhtmltopdf 二进制路径?我们如何在 Heroku 中使用配置变量来完成这项工作
我试过这个generate-pdfs-wkhtmltopdf-heroku但无法得到它。在我搜索的任何地方都可以找到我们需要配置 gem 文件的 ruby 解决方案,我怎么能在 python 中做到这一点
我这两天一直在做,请帮帮我
提前致谢
梅加娜·古德